Java Code Examples for org.hibernate.ConnectionReleaseMode#AFTER_TRANSACTION
The following examples show how to use
org.hibernate.ConnectionReleaseMode#AFTER_TRANSACTION .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JdbcCoordinatorImpl.java From lams with GNU General Public License v2.0 | 6 votes |
private ConnectionReleaseMode determineConnectionReleaseMode( JdbcConnectionAccess jdbcConnectionAccess, boolean isUserSuppliedConnection, ConnectionReleaseMode connectionReleaseMode) { if ( isUserSuppliedConnection ) { return ConnectionReleaseMode.ON_CLOSE; } else if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT && ! jdbcConnectionAccess.supportsAggressiveRelease() ) { LOG.debug( "Connection provider reports to not support aggressive release; overriding" ); return ConnectionReleaseMode.AFTER_TRANSACTION; } else { return connectionReleaseMode; } }
Example 2
Source File: JDBCContext.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
public JDBCContext(Context owner, Connection connection, Interceptor interceptor) { this.owner = owner; this.connectionManager = new ConnectionManager( owner.getFactory(), this, owner.getConnectionReleaseMode(), connection, interceptor ); final boolean registerSynchronization = owner.isAutoCloseSessionEnabled() || owner.isFlushBeforeCompletionEnabled() || owner.getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_TRANSACTION; if ( registerSynchronization ) { registerSynchronizationIfPossible(); } }
Example 3
Source File: ConnectionManager.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Will connections be released after each statement execution? * <p/> * Connections will be released after each statement if either:<ul> * <li>the defined release-mode is {@link ConnectionReleaseMode#AFTER_STATEMENT}; or * <li>the defined release-mode is {@link ConnectionReleaseMode#AFTER_TRANSACTION} but * we are in auto-commit mode. * <p/> * release-mode = {@link ConnectionReleaseMode#ON_CLOSE} should [b]never[/b] release * a connection. * * @return True if the connections will be released after each statement; false otherwise. */ public boolean isAggressiveRelease() { if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { return true; } else if ( releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION ) { boolean inAutoCommitState; try { inAutoCommitState = isAutoCommit()&& !callback.isTransactionInProgress(); } catch( SQLException e ) { // assume we are in an auto-commit state inAutoCommitState = true; } return inAutoCommitState; } return false; }
Example 4
Source File: ConnectionManager.java From cacheonix-core with GNU Lesser General Public License v2.1 | 6 votes |
/** * Modified version of {@link #isAggressiveRelease} which does not force a * transaction check. This is solely used from our {@link #afterTransaction} * callback, so no need to do the check; plus it seems to cause problems on * websphere (god i love websphere ;) * </p> * It uses this information to decide if an aggressive release was skipped * do to open resources, and if so forces a release. * * @return True if the connections will be released after each statement; false otherwise. */ private boolean isAggressiveReleaseNoTransactionCheck() { if ( releaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { return true; } else { boolean inAutoCommitState; try { inAutoCommitState = isAutoCommit(); } catch( SQLException e ) { // assume we are in an auto-commit state inAutoCommitState = true; } return releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION && inAutoCommitState; } }
Example 5
Source File: JdbcCoordinatorImpl.java From lams with GNU General Public License v2.0 | 5 votes |
@Override public void afterTransaction() { transactionTimeOutInstant = -1; if ( getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT || getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_TRANSACTION ) { this.logicalConnection.afterTransaction(); } }
Example 6
Source File: JDBCTransactionFactory.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
public ConnectionReleaseMode getDefaultReleaseMode() { return ConnectionReleaseMode.AFTER_TRANSACTION; }
Example 7
Source File: ConnectionManager.java From cacheonix-core with GNU Lesser General Public License v2.1 | 4 votes |
private boolean isAfterTransactionRelease() { return releaseMode == ConnectionReleaseMode.AFTER_TRANSACTION; }