HHH-14326 Always close the connection even if releasing JDBC resources fails
Signed-off-by: Yoann Rodière <yoann@hibernate.org>
This commit is contained in:
parent
74433cdec3
commit
e5c830da19
|
@ -214,13 +214,17 @@ public class LogicalConnectionManagedImpl extends AbstractLogicalConnectionImple
|
|||
throw new HibernateException( "Detected concurrent management of connection resources." +
|
||||
" This might indicate a multi-threaded use of Hibernate in combination with managed resources, which is not supported." );
|
||||
}
|
||||
try {
|
||||
try {
|
||||
getResourceRegistry().releaseResources();
|
||||
if ( !localVariableConnection.isClosed() ) {
|
||||
sqlExceptionHelper.logAndClearWarnings( localVariableConnection );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
jdbcConnectionAccess.releaseConnection( localVariableConnection );
|
||||
}
|
||||
}
|
||||
catch (SQLException e) {
|
||||
throw sqlExceptionHelper.convert( e, "Unable to release JDBC Connection" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue