HHH-2604 : Isolator.JdbcDelegate connection releasing

git-svn-id: https://svn.jboss.org/repos/hibernate/core/branches/Branch_3_2@14999 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-07-31 15:10:43 +00:00
parent 1d89a18d2d
commit 5e1a485f4e
2 changed files with 20 additions and 20 deletions

View File

@ -215,6 +215,7 @@ else if ( t instanceof SQLException ) {
} }
} }
finally { finally {
if ( connection != null ) {
if ( transacted && wasAutoCommit ) { if ( transacted && wasAutoCommit ) {
try { try {
connection.setAutoCommit( true ); connection.setAutoCommit( true );
@ -228,3 +229,4 @@ else if ( t instanceof SQLException ) {
} }
} }
} }
}

View File

@ -590,12 +590,14 @@ public Connection openConnection() throws HibernateException {
} }
public void closeConnection(Connection conn) throws HibernateException { public void closeConnection(Connection conn) throws HibernateException {
if ( conn == null ) {
log.debug( "found null connection on AbstractBatcher#closeConnection" );
// EARLY EXIT!!!!
return;
}
if ( log.isDebugEnabled() ) { if ( log.isDebugEnabled() ) {
log.debug( log.debug( "closing JDBC connection" + preparedStatementCountsToString() + resultSetCountsToString() );
"closing JDBC connection" +
preparedStatementCountsToString() +
resultSetCountsToString()
);
} }
try { try {
@ -605,11 +607,7 @@ public void closeConnection(Connection conn) throws HibernateException {
factory.getConnectionProvider().closeConnection( conn ); factory.getConnectionProvider().closeConnection( conn );
} }
catch ( SQLException sqle ) { catch ( SQLException sqle ) {
throw JDBCExceptionHelper.convert( throw JDBCExceptionHelper.convert( factory.getSQLExceptionConverter(), sqle, "Cannot close connection" );
factory.getSQLExceptionConverter(),
sqle,
"Cannot close connection"
);
} }
} }