openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From flyisland <fly.isl...@gmail.com>
Subject ConcurrentModificationException occurs while using OpenJpa/Spring with ZK
Date Thu, 18 Oct 2007 16:39:29 GMT
Hi,

I'm writing a program with OpenJpa-1.0.0 and Spring-2.0.7 and (of course)
ZK-3.0.0-RC now, I created a "service" class extended from Spring's
JpaDaoSupport, and used Spring's annotation "@Transactional" to control the
transaction, and employed ZK(http://www.zkoss.org/) as the UI. The program
is ran on Tomcat 5.2.2.

Now, I can display domain entries with ZK and persist the single enties,  it
works well.

BUT I got the "ConcurrentModificationException" while doing the following
steps:
1) show a list of "Account" domain class
2) the user selected an "Account" as parent to create a "child" account
3) invoke "child".setParent(); and invoke "service".persist(child)

the exception stack is:
>>java.util.ConcurrentModificationException
>>    at java.util.HashMap$HashIterator.nextEntry()Ljava.util.HashMap$Entry;(Unknown
Source)
>>    at java.util.HashMap$KeyIterator.next()Ljava.lang.Object;(Unknown
Source)
>>    at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.dirtyCheck(
BrokerImpl.java:4612)
>>    at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.access$000(
BrokerImpl.java:4352)
>>    at org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(
BrokerImpl.java:3731)
>>    at org.apache.openjpa.kernel.BrokerImpl.getTransactionalStates(
BrokerImpl.java:3720)
>>    at org.apache.openjpa.kernel.BrokerImpl.flush(BrokerImpl.java:1863)

It seems that entity A has a reference to entity B, if I got B first, then
try to persist A later, it will throw the ConcurrentModificationException.

Any idea about how to avoid this exception will be appreciated!

regards,
island chen

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message