Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 14032 invoked from network); 21 Oct 2007 16:29:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Oct 2007 16:29:25 -0000 Received: (qmail 71363 invoked by uid 500); 21 Oct 2007 16:29:13 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 71333 invoked by uid 500); 21 Oct 2007 16:29:13 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 71323 invoked by uid 99); 21 Oct 2007 16:29:13 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Oct 2007 09:29:13 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of plinskey@gmail.com designates 209.85.198.187 as permitted sender) Received: from [209.85.198.187] (HELO rv-out-0910.google.com) (209.85.198.187) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 21 Oct 2007 16:28:54 +0000 Received: by rv-out-0910.google.com with SMTP id k20so1209649rvb for ; Sun, 21 Oct 2007 09:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=aJfRRdtmmRPsN2HzqeD+KU5m3DvHs2E0bRyZ+U0ZOMw=; b=HgJosuP6fELdNEtgP8Qc87ZvhLi6r4QFW4soxS569uZoBTHP1DOqgqWSwwoIEETn8AHpNLLf66NxgKIGB6LS+0Zc36zAksxxH+he1GfcJBggc7UFr8lssBKeNLE5DRF+nUSKu84gsi66hcgnMftQgpncdOcFoYOQJZ+erU+Tzk4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=e+bBuUMIm63y2p19B8i5VRdOr22nOQxe6Zwc5kP4E3djblDMTDssbVDx/OLqykuuCPIoJeY/S8nrQwwrpPQhd6gRjbnGD2+5tIjlYewV1tbibffxUqe0X97BTv4VUqbe0FTp7mGd5TPdGBuA7Ew+nBke7D2gRYpk62Yd6aVJ+1A= Received: by 10.142.245.10 with SMTP id s10mr1065478wfh.1192984106208; Sun, 21 Oct 2007 09:28:26 -0700 (PDT) Received: by 10.143.165.19 with HTTP; Sun, 21 Oct 2007 09:28:26 -0700 (PDT) Message-ID: <7262f25e0710210928g44fddd10he7b4b1e28afd38bd@mail.gmail.com> Date: Sun, 21 Oct 2007 09:28:26 -0700 From: "Patrick Linskey" To: dev@openjpa.apache.org Subject: Re: ConcurrentModificationException occurs while using OpenJpa/Spring with ZK In-Reply-To: <32533de10710180939p3fa4e794hdce9ac8bcb77377a@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <32533de10710180939p3fa4e794hdce9ac8bcb77377a@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org 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 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