HHH-8459 - Improved handling of JPA schema-generation target files

This commit is contained in:
Steve Ebersole 2013-09-12 08:49:52 -05:00
parent 0bf29bc2fd
commit d0b556ece6
1 changed files with 6 additions and 0 deletions

View File

@ -682,6 +682,8 @@ public class JpaSchemaGenerator {
@Override @Override
public void releaseConnection(Connection connection) throws SQLException { public void releaseConnection(Connection connection) throws SQLException {
// NOTE : reset auto-commit, but *do not* close the Connection. The application handed us this connection
if ( ! wasInitiallyAutoCommit ) { if ( ! wasInitiallyAutoCommit ) {
try { try {
if ( jdbcConnection.getAutoCommit() ) { if ( jdbcConnection.getAutoCommit() ) {
@ -763,6 +765,7 @@ public class JpaSchemaGenerator {
); );
} }
// Reset auto-commit
if ( ! wasInitiallyAutoCommit ) { if ( ! wasInitiallyAutoCommit ) {
try { try {
if ( jdbcConnection.getAutoCommit() ) { if ( jdbcConnection.getAutoCommit() ) {
@ -773,6 +776,9 @@ public class JpaSchemaGenerator {
log.info( "Was unable to reset JDBC connection to no longer be in auto-commit mode" ); log.info( "Was unable to reset JDBC connection to no longer be in auto-commit mode" );
} }
} }
// Release the connection
connectionProvider.closeConnection( jdbcConnection );
} }
@Override @Override