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:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:addSession, doesNotHoldNonDefaultSession, getValidatedSession, isEmpty, setPreviousFlushMode

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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) {}
 
	@Override 
	public <T> boolean handleTimeout(NativeWebRequest request, DeferredResult<T> deferredResult) {
		this.timeoutInProgress = true;
		return true; // give other interceptors a chance to handle the timeout 
	} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
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
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
This code example shows how to use the following methods:setSessionFactory
 
@Repository("organizationDao") 
public class OrganizationDaoImpl extends HibernateDaoSupport implements OrganizationDao { 
 
  @Autowired 
  public OrganizationDaoImpl(SessionFactory sessionFactory) { 
    setSessionFactory(sessionFactory); 
  } 
 
  public Organization load(Long id) { 
    return (Organization) getHibernateTemplate().load(Organization.class, id); 
  } 
 
  public Organization persist(Organization organization) { 
    getHibernateTemplate().saveOrUpdate(organization); 
    return organization; 
  } 
 
  @SuppressWarnings("unchecked") 
  public Organization findByName(String orgName) { 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setPackagesToScan, afterPropertiesSet, getObject, setDataSource, setHibernateProperties
public class AppConfigWithoutComponentScan 
{ 
    @Bean 
    public SessionFactory sessionFactory() throws ExceptionAnnotationSessionFactoryBean bean = new AnnotationSessionFactoryBean();
        bean.setDataSource(dataSource());
        bean.setPackagesToScan(new String[] {"org.springframework.issues"});
        bean.setHibernateProperties(hibernateProps());
        bean.afterPropertiesSet();
        return bean.getObject();
    } 
 
    private Properties hibernateProps()
    { 
        Properties jpaProperties = new Properties();
        jpaProperties.put("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
        jpaProperties.put("hibernate.hbm2ddl.auto", "create-drop");
        jpaProperties.put("hibernate.show_sql", false);
        jpaProperties.put("hibernate.format_sql", true);
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getSessionFactory, isAllowCreate, getEntityInterceptor, getJdbcExceptionTranslator
 
	/** 
	 * Return the Hibernate SessionFactory used by this DAO. 
	 */ 
	public final SessionFactory getSessionFactory() { 
		return (this.hibernateTemplate != null ? this.hibernateTemplate.getSessionFactory() : null); 
	} 
 
	/** 
	 * Set the HibernateTemplate for this DAO explicitly, 
	 * as an alternative to specifying a SessionFactory. 
	 * @see #setSessionFactory 
	 */ 
	public final void setHibernateTemplate(HibernateTemplate hibernateTemplate) { 
		this.hibernateTemplate = hibernateTemplate; 
	} 
 
	/** 
	 * Return the HibernateTemplate for this DAO, 
	 * pre-initialized with the SessionFactory or set explicitly. 

7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java