Author: allee8285
Date: Tue Apr 10 22:33:08 2012
New Revision: 1312030

URL: http://svn.apache.org/viewvc?rev=1312030&view=rev
Log:
OPENJPA-2170 - Clear the batching cache regardless if the batch execution has 
succeeded or failed to avoid duplicated SQL updates.

Modified:
    
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java

Modified: 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
URL: 
http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java?rev=1312030&r1=1312029&r2=1312030&view=diff
==============================================================================
--- 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
 (original)
+++ 
openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
 Tue Apr 10 22:33:08 2012
@@ -96,8 +96,12 @@ public class BatchingPreparedStatementMa
                 break;
             case 1:
                 // single entry in cache, direct SQL execution. 
-                super.flushAndUpdate((RowImpl) _batchedRows.get(0));
-                _batchedRows.clear();
+                try {
+                    super.flushAndUpdate((RowImpl) _batchedRows.get(0));
+                } finally {
+                    _batchedSql = null;
+                    _batchedRows.clear();
+                }
                 break;
             default:
                 // flush all entries in cache in batch.


Reply via email to