List of usage examples for org.hibernate ConnectionReleaseMode AFTER_STATEMENT
ConnectionReleaseMode AFTER_STATEMENT
To view the source code for org.hibernate ConnectionReleaseMode AFTER_STATEMENT.
Click Source Link
From source file:com.cubeia.firebase.service.persistence.jpa.SystemTransactionFactory.java
License:Open Source License
public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
From source file:com.fiveamsolutions.nci.commons.util.HibernateHelper.java
License:Open Source License
/** * Open a hibernate session and bind it as the current session via * {@link ManagedSessionContext#bind(org.hibernate.classic.Session)}. The hibernate property * "hibernate.current_session_context_class" must be set to "managed" for this to have effect This method should be * called from within an Interceptor or Filter type class that is setting up the scope of the Session. This method * should then call {@link HibernateUtil#unbindAndCleanupSession()} when the scope of the Session is expired. * * @see ManagedSessionContext#bind(org.hibernate.classic.Session) * @param sf the session factory.//w ww . j a v a2s. c o m */ public void openAndBindSession(SessionFactory sf) { SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) sf; org.hibernate.classic.Session currentSession = sessionFactoryImplementor.openSession(null, true, false, ConnectionReleaseMode.AFTER_STATEMENT); currentSession.setFlushMode(FlushMode.COMMIT); ManagedSessionContext.bind(currentSession); }
From source file:com.github.jmnarloch.hstreams.internal.StreamSessionBuilderDelegateTest.java
License:Apache License
@Test public void testConnectionReleaseMode() throws Exception { // given/*w ww.ja va 2 s . c o m*/ final ConnectionReleaseMode releaseMode = ConnectionReleaseMode.AFTER_STATEMENT; // then verifyMethodCall(sb -> sb.connectionReleaseMode(releaseMode)); }
From source file:gov.nih.nci.lv.util.HibernateHelper.java
License:BSD License
/** * Open a hibernate session and bind it as the current session via * {@link ManagedSessionContext#bind(org.hibernate.classic.Session)}. The hibernate property * "hibernate.current_session_context_class" must be set to "managed" for this to have effect This method should be * called from within an Interceptor or Filter type class that is setting up the scope of the Session. This method * should then call {@link HibernateUtil#unbindAndCleanupSession()} when the scope of the Session is expired. * * @see ManagedSessionContext#bind(org.hibernate.classic.Session) *//*from ww w.j a v a 2 s. co m*/ public void openAndBindSession() { SessionFactoryImplementor sessionFactoryImplementor = (SessionFactoryImplementor) getSessionFactory(); org.hibernate.classic.Session currentSession = sessionFactoryImplementor.openSession(null, true, false, ConnectionReleaseMode.AFTER_STATEMENT); currentSession.setFlushMode(FlushMode.COMMIT); ManagedSessionContext.bind(currentSession); }
From source file:org.apache.ode.daohib.JotmTransactionFactory.java
License:Open Source License
/** * {@inheritDoc} */ public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_STATEMENT; }
From source file:org.ow2.bonita.persistence.db.DbSessionImpl.java
License:Open Source License
private boolean shouldReleaseConnections() { return ((SessionFactoryImplementor) session.getSessionFactory()).getSettings() .getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT; }