Code example for HibernateAccessor

Methods: getSessionFactory

0
    public OpenSessionInThread() { 
        setFlushMode(FLUSH_AUTO); 
    } 
     
    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()); 
    } 
} 
Experience pair programming with AI  Get Codota for Java