Skip to content

Commit db124aa

Browse files
committed
On Connection initialisation, setAutoCommit() mode later (after clientInfo etc)
This change means that autoCommit true will be active while clientInfo is being set and initSql executed. Specifically, clientInfo is not supposed to need autoCommit true (or an explicit commit) but it does seem so for Postgres, and for a very idle database using autoCommit false and setting clientInfo ApplicationName.
1 parent f392671 commit db124aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@ private Connection initConnection(Connection conn) throws SQLException {
439439
if (connectionInitializer != null) {
440440
connectionInitializer.preInitialize(conn);
441441
}
442-
conn.setAutoCommit(autoCommit);
443442
// isolation level is set globally for all connections (at least for H2) and
444443
// you will need admin rights - so we do not change it, if it already matches.
445444
if (conn.getTransactionIsolation() != transactionIsolation) {
@@ -475,6 +474,7 @@ private Connection initConnection(Connection conn) throws SQLException {
475474
}
476475
}
477476
}
477+
conn.setAutoCommit(autoCommit);
478478
if (connectionInitializer != null) {
479479
connectionInitializer.postInitialize(conn);
480480
}

0 commit comments

Comments
 (0)