OPENJPA-574 DataCache entries not evicted when multiple OptimisticLockExceptions reported from backend DB.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@654337 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Catalina Wei 2008-05-08 00:18:11 +00:00
parent 63850bed0b
commit b796e1710f
1 changed files with 7 additions and 4 deletions

View File

@ -222,9 +222,9 @@ public class BatchingPreparedStatementManagerImpl extends
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 @@ public class BatchingPreparedStatementManagerImpl extends
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());