From 7976ad976e37ad96461794065efc2cd590faa8a0 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Mon, 5 Jun 2006 15:51:35 +0000 Subject: [PATCH] Applied http://issues.apache.org/activemq/browse/AMQ-711 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@411832 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/store/jdbc/TransactionContext.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java index ee5f4fda10..c4f33b511c 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java @@ -104,7 +104,6 @@ public class TransactionContext { public void close() throws IOException { if( !inTx ) { try { - executeBatch(); /** * we are not in a transaction so should not be committing ?? @@ -115,7 +114,7 @@ public class TransactionContext { try{ executeBatch(); } finally { - if (connection != null) { + if (connection != null && !connection.getAutoCommit()) { connection.commit(); } } @@ -149,7 +148,8 @@ public class TransactionContext { throw new IOException("Not started."); try { executeBatch(); - connection.commit(); + if( !connection.getAutoCommit() ) + connection.commit(); } catch (SQLException e) { JDBCPersistenceAdapter.log("Commit failed: ", e); throw IOExceptionSupport.create(e);