Spring Framework SessionHolder - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework SessionHolder class.

This code example shows how to use the following methods:
			request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST); 
		} 
		else { 
			logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor"); 
			Session session = openSession(); 
			SessionHolder sessionHolder = new SessionHolder(session); 
			TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder); 
 
			AsyncRequestInterceptor asyncRequestInterceptor = 
					new AsyncRequestInterceptor(getSessionFactory(), sessionHolder); 
			asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor); 
			asyncManager.registerDeferredResultInterceptor(participateAttributeName, asyncRequestInterceptor); 
		} 
	} 
 
	@Override 
	public void postHandle(WebRequest request, ModelMap model) { 
	} 
 
	/** 
6
CodeRank
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
This code example shows how to use the following methods:getSession
	} 
 
	private void closeAfterTimeout() { 
		if (this.timeoutInProgress) {
			logger.debug("Closing Hibernate Session after async request timeout");
			SessionFactoryUtils.closeSession(sessionHolder.getSession());
		} 
	} 
 
 
	// Implementation of DeferredResultProcessingInterceptor methods 
 
	public <T> void beforeConcurrentHandling(NativeWebRequest request, DeferredResult<T> deferredResult) {
	} 
 
	public <T> void preProcess(NativeWebRequest request, DeferredResult<T> deferredResult) {
	} 
 
	public <T> void postProcess(NativeWebRequest request, DeferredResult<T> deferredResult, Object result) {
	} 
6
CodeRank
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setMappingLocations
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
This code example shows how to use the following methods:afterPropertiesSet, getObject, setDataSource, setHibernateProperties, setPackagesToScan
  } 
 
  @Bean 
  public SessionFactory sessionFactoryBean() { 
    try { 
      LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean(); 
      lsfb.setDataSource(dataSource()); 
      lsfb.setPackagesToScan("spittr.domain"); 
      Properties props = new Properties(); 
      props.setProperty("dialect", "org.hibernate.dialect.H2Dialect"); 
      lsfb.setHibernateProperties(props); 
      lsfb.afterPropertiesSet(); 
      SessionFactory object = lsfb.getObject(); 
      return object; 
    } catch (IOException e) { 
      return null; 
    } 
  } 
} 
6
CodeRank
This code example shows how to use the following methods:setDataSource, setHibernateProperties, setPackagesToScan
    @Autowired 
    private PropertiesStrategyManager hibPropStrategyManager; 
 
    @Bean 
    public LocalSessionFactoryBean gpSessionFactoryBean() { 
        final LocalSessionFactoryBean factoryBean = new LocalSessionFactoryBean(); 
        factoryBean.setDataSource(this.persitenceDataSource); 
        factoryBean.setPackagesToScan( 
                this.gpPersistenceConnector.getPackagesToScan()); 
        factoryBean.setHibernateProperties( 
                this.hibPropStrategyManager.getProperties()); 
 
        return factoryBean; 
    } 
 
    @Bean 
    public HibernateTransactionManager transactionManager() { 
        final HibernateTransactionManager txManager = new HibernateTransactionManager(); 
        txManager.setSessionFactory(this.gpSessionFactoryBean().getObject()); 
 
6
CodeRank
This code example shows how to use the following methods:
     
    public void sessionStart() { 
        if (!(TransactionSynchronizationManager.hasResource(getSessionFactory()) || SessionFactoryUtils.isDeferredCloseActive(getSessionFactory()))) { 
            Session session = SessionFactoryUtils.getSession(getSessionFactory(), getEntityInterceptor(), getJdbcExceptionTranslator()); 
            applyFlushMode(session, false); 
            TransactionSynchronizationManager.bindResource(getSessionFactory(), new SessionHolder(session)); 
        } 
    } 
     
    public void sessionStop() { 
        SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory()); 
	SessionFactoryUtils.closeSession(sessionHolder.getSession()); 
    } 
} 
6
CodeRank