From dcada1323742967f4e066cc88ac1d9ed46f16102 Mon Sep 17 00:00:00 2001 From: Catalina Wei Date: Thu, 22 May 2008 08:05:00 +0000 Subject: [PATCH] OPENJPA-574 Cached object in DataCache not evicted due to StatementBatching not reporting OptimisticException Handle (-2) updateCount returned from Batching for Oracle. Got a ClassCasstException while testing multiple entries in DataCache needed to be removed due to OptimisticException. git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@659036 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/datacache/DataCacheStoreManager.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java index c3c7dbe12..5e802109c 100644 --- a/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java +++ b/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheStoreManager.java @@ -270,6 +270,7 @@ public class DataCacheStoreManager idList.add(holder.sm.getObjectId()); } + List removes = new ArrayList(); Map pcdatas = cache.getAll(idList); for (Entry entry : pcdatas.entrySet()) { Integer index = ids.get(entry.getKey()); @@ -277,10 +278,13 @@ public class DataCacheStoreManager PCDataHolder holder = (PCDataHolder) holders.get(index); if (oldpc != null && compareVersion(holder.sm, holder.sm.getVersion(), oldpc.getVersion()) == VERSION_EARLIER) - holders.remove(index); + removes.add(holder); else holders.set(index, holder.pcdata); } + + for (PCDataHolder holder : removes) + holders.remove(holder); } /**