openjpa-dev mailing list archives

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

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( 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
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:
>>    at java.util.HashMap$HashIterator.nextEntry()Ljava.util.HashMap$Entry;(Unknown
>>    at java.util.HashMap$;(Unknown
>>    at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.dirtyCheck(
>>    at org.apache.openjpa.kernel.BrokerImpl$ManagedCache.access$000(
>>    at org.apache.openjpa.kernel.BrokerImpl.hasTransactionalObjects(
>>    at org.apache.openjpa.kernel.BrokerImpl.getTransactionalStates(
>>    at org.apache.openjpa.kernel.BrokerImpl.flush(

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!

island chen

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