From db124aa0dce9685ff4b003351fbbdf92daacb52a Mon Sep 17 00:00:00 2001 From: Rob Bygrave Date: Sat, 14 Feb 2026 14:49:13 +1300 Subject: [PATCH] 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. --- .../src/main/java/io/ebean/datasource/pool/ConnectionPool.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java b/ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java index bcd3c95..47b32cf 100644 --- a/ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java +++ b/ebean-datasource/src/main/java/io/ebean/datasource/pool/ConnectionPool.java @@ -439,7 +439,6 @@ private Connection initConnection(Connection conn) throws SQLException { if (connectionInitializer != null) { connectionInitializer.preInitialize(conn); } - conn.setAutoCommit(autoCommit); // isolation level is set globally for all connections (at least for H2) and // you will need admin rights - so we do not change it, if it already matches. if (conn.getTransactionIsolation() != transactionIsolation) { @@ -475,6 +474,7 @@ private Connection initConnection(Connection conn) throws SQLException { } } } + conn.setAutoCommit(autoCommit); if (connectionInitializer != null) { connectionInitializer.postInitialize(conn); }