Skip to content

Commit d0b556e

Browse files
committed
HHH-8459 - Improved handling of JPA schema-generation target files
1 parent 0bf29bc commit d0b556e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

hibernate-entitymanager/src/main/java/org/hibernate/jpa/internal/schemagen/JpaSchemaGenerator.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,8 @@ public Connection obtainConnection() throws SQLException {
682682

683683
@Override
684684
public void releaseConnection(Connection connection) throws SQLException {
685+
// NOTE : reset auto-commit, but *do not* close the Connection. The application handed us this connection
686+
685687
if ( ! wasInitiallyAutoCommit ) {
686688
try {
687689
if ( jdbcConnection.getAutoCommit() ) {
@@ -763,6 +765,7 @@ public void releaseConnection(Connection connection) throws SQLException {
763765
);
764766
}
765767

768+
// Reset auto-commit
766769
if ( ! wasInitiallyAutoCommit ) {
767770
try {
768771
if ( jdbcConnection.getAutoCommit() ) {
@@ -773,6 +776,9 @@ public void releaseConnection(Connection connection) throws SQLException {
773776
log.info( "Was unable to reset JDBC connection to no longer be in auto-commit mode" );
774777
}
775778
}
779+
780+
// Release the connection
781+
connectionProvider.closeConnection( jdbcConnection );
776782
}
777783

778784
@Override

0 commit comments

Comments
 (0)