HHH-2604 : Isolator.JdbcDelegate connection releasing

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14998 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-07-31 15:10:19 +00:00
parent ec7288458e
commit 197d3afd35
2 changed files with 20 additions and 20 deletions

View File

@ -239,15 +239,17 @@ public class Isolater {
}
}
finally {
if ( transacted && wasAutoCommit ) {
try {
connection.setAutoCommit( true );
}
catch( Throwable ignore ) {
log.trace( "was unable to reset connection back to auto-commit" );
if ( connection != null ) {
if ( transacted && wasAutoCommit ) {
try {
connection.setAutoCommit( true );
}
catch( Throwable ignore ) {
log.trace( "was unable to reset connection back to auto-commit" );
}
}
session.getBatcher().closeConnection( connection );
}
session.getBatcher().closeConnection( connection );
}
}
}

View File

@ -596,26 +596,24 @@ public abstract class AbstractBatcher implements Batcher {
}
public void closeConnection(Connection conn) throws HibernateException {
if ( conn == null ) {
log.debug( "found null connection on AbstractBatcher#closeConnection" );
// EARLY EXIT!!!!
return;
}
if ( log.isDebugEnabled() ) {
log.debug(
"closing JDBC connection" +
preparedStatementCountsToString() +
resultSetCountsToString()
);
log.debug( "closing JDBC connection" + preparedStatementCountsToString() + resultSetCountsToString() );
}
try {
if ( !conn.isClosed() ) {
JDBCExceptionReporter.logAndClearWarnings(conn);
JDBCExceptionReporter.logAndClearWarnings( conn );
}
factory.getConnectionProvider().closeConnection(conn);
factory.getConnectionProvider().closeConnection( conn );
}
catch (SQLException sqle) {
throw JDBCExceptionHelper.convert(
factory.getSQLExceptionConverter(),
sqle,
"Cannot close connection"
);
catch ( SQLException sqle ) {
throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), sqle, "Cannot close connection" );
}
}