openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey" <plins...@gmail.com>
Subject Re: ConcurrentModificationException occurs while using OpenJpa/Spring with ZK
Date Sun, 21 Oct 2007 16:28:26 GMT
Hi,

I'm not that  familiar with Spring's JpaDaoSupport classes; is there
any reason you're going the DAO route instead of using the JPA APIs
directly?

Do you know if in your context, a single EntityManager is being used
for the duration of the operations, or if the DAO calls result in
multiple EntityManagers being used?

-Patrick

On 10/18/07, flyisland <fly.island@gmail.com> wrote:
> 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
>


-- 
Patrick Linskey
202 669 5907

Mime
View raw message