openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fa...@apache.org
Subject svn commit: r654337 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/BatchingPreparedStatementManagerImpl.java
Date Thu, 08 May 2008 00:18:11 GMT
Author: fancy
Date: Wed May  7 17:18:11 2008
New Revision: 654337

URL: http://svn.apache.org/viewvc?rev=654337&view=rev
Log:
OPENJPA-574 DataCache entries not evicted when multiple OptimisticLockExceptions reported
from backend DB.

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=654337&r1=654336&r2=654337&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
Wed May  7 17:18:11 2008
@@ -222,9 +222,9 @@
         for (int i = 0; i < count.length; i++) {
             cnt = count[i];
             RowImpl row = (RowImpl) _batchedRows.get(batchedRowsBaseIndex + i);
+            failed = row.getFailedObject();
             switch (cnt) {
             case Statement.EXECUTE_FAILED: // -3
-                failed = row.getFailedObject();
                 if (failed != null || row.getAction() == Row.ACTION_UPDATE)
                     _exceptions.add(new OptimisticException(failed));
                 else if (row.getAction() == Row.ACTION_INSERT)
@@ -233,14 +233,17 @@
                         String.valueOf(count[i]), _batchedSql).getMessage());
                 break;
             case Statement.SUCCESS_NO_INFO: // -2
-                if (_log.isTraceEnabled())
+                if (failed != null || row.getAction() == Row.ACTION_UPDATE)
+                    _exceptions.add(new OptimisticException(failed));
+                else if (_log.isTraceEnabled())
                     _log.trace(_loc.get("batch_update_info",
                         String.valueOf(cnt), _batchedSql).getMessage());
                 break;
             case 0: // no row is inserted, treats it as failed
                 // case
-                failed = row.getFailedObject();
-                if ((failed != null || row.getAction() == Row.ACTION_INSERT))
+                if (failed != null || row.getAction() == Row.ACTION_UPDATE)
+                    _exceptions.add(new OptimisticException(failed));
+                else
                     throw new SQLException(_loc.get(
                         "update-failed-no-failed-obj",
                         String.valueOf(count[i]), _batchedSql).getMessage());



Mime
View raw message