From 8e7a959f39733828f9564ccd9a4fc3f6ae5aeebf Mon Sep 17 00:00:00 2001 From: Zrips Date: Mon, 28 Oct 2019 12:49:09 +0200 Subject: [PATCH] Lets switch autocommit when commiting in case its in true state --- src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java b/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java index 0ddab673..7baad482 100644 --- a/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java +++ b/src/main/java/com/gamingmesh/jobs/dao/JobsConnection.java @@ -51,7 +51,13 @@ public class JobsConnection { } public synchronized void commit() throws SQLException { - conn.commit(); + if (conn.getAutoCommit()) { + conn.setAutoCommit(false); + conn.commit(); + conn.setAutoCommit(true); + } else { + conn.commit(); + } } public synchronized DatabaseMetaData getMetaData() throws SQLException {