Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 93956 invoked from network); 2 Nov 2005 16:25:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Nov 2005 16:25:07 -0000 Received: (qmail 62043 invoked by uid 500); 2 Nov 2005 16:25:06 -0000 Mailing-List: contact jdo-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: jdo-dev@db.apache.org Delivered-To: mailing list jdo-dev@db.apache.org Received: (qmail 62031 invoked by uid 99); 2 Nov 2005 16:25:06 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Nov 2005 08:25:06 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [192.18.98.34] (HELO brmea-mail-3.sun.com) (192.18.98.34) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 Nov 2005 08:25:01 -0800 Received: from fe-amer-10.sun.com ([192.18.108.184]) by brmea-mail-3.sun.com (8.12.10/8.12.9) with ESMTP id jA2GOj3F002771 for ; Wed, 2 Nov 2005 09:24:45 -0700 (MST) Received: from conversion-daemon.mail-amer.sun.com by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) id <0IPC004015HUYT00@mail-amer.sun.com> (original mail from Craig.Russell@Sun.COM) for jdo-dev@db.apache.org; Wed, 02 Nov 2005 09:24:45 -0700 (MST) Received: from [192.168.0.10] ([24.6.172.77]) by mail-amer.sun.com (Sun Java System Messaging Server 6.2-4.02 (built Sep 9 2005)) with ESMTPSA id <0IPC00FHY5L8FA64@mail-amer.sun.com> for jdo-dev@db.apache.org; Wed, 02 Nov 2005 09:24:45 -0700 (MST) Date: Wed, 02 Nov 2005 08:24:45 -0800 From: Craig L Russell Subject: Re: Issue 135: Remove attachCopy from PersistenceManager In-reply-to: <4368DB87.5070109@spree.de> Sender: Craig.Russell@Sun.COM To: jdo-dev@db.apache.org Cc: JDO Expert Group Message-id: <8C4CB93F-15F5-478F-A0EE-3C52418E26DD@sun.com> MIME-version: 1.0 X-Mailer: Apple Mail (2.734) Content-type: text/plain; format=flowed; delsp=yes; charset=ISO-8859-1 Content-transfer-encoding: QUOTED-PRINTABLE References: <4368D9F7.8040409@artnology.com> <4368DB87.5070109@spree.de> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Hi, On Nov 2, 2005, at 7:30 AM, Michael Bouschen wrote: > Hi J=F6rg, > > good catch! Yes, the examples are meant to use two different =20 > PersistenceManagers pm1 and pm2. > > I think JDOHelper.shallowCopy would work for any instance of a = =20 > persistence capable class, not only for detached instances. > The semantics of JDOHelper.shallowCopyAll would be to make an object = =20 graph suitable for attachment. So there would be a copy made of =20 transient and detached instances but persistent instances would not = =20 be copied. Perhaps shallowCopyAll isn't the right name since we don't shallow = =20 copy persistent instances. Maybe something like copyForAttachment or = =20 something like it. > > Regards Michael Regards, Craig > > >> Craig L Russell schrieb: >> >>> With this change, there is no standard way to attach the same = =20 >>> object graph to multiple persistence managers. So a method is = =20 >>> added to JDOHelper that copies a complete object graph so the = =20 >>> copies can be attached to multiple persistence managers. >>> >>> Instead of: >>> Object[ ] attached1 =3D pm.attachCopy(graph); >>> Object[ ] attached2 =3D pm.attachCopy(graph); >>> >>> use: >>> Object[ ] copies =3D JDOHelper.shallowCopy(graph, false); >>> Object[ ] attached1 =3D pm.makePersistentAll(copies); >>> Object[ ] attached2 =3D pm.makePersistentAll(copies); >>> >> There is only one and the same persistence manager being used in = =20 >> these examples, shouldn't it be more like: >> Instead of: >> Object[ ] attached1 =3D pm1.attachCopy(graph); >> Object[ ] attached2 =3D pm2.attachCopy(graph); >> use: >> Object[ ] copies =3D JDOHelper.shallowCopy(graph, false); >> Object[ ] attached1 =3D pm1.makePersistentAll(copies); >> Object[ ] attached2 =3D pm2.makePersistentAll(copies); >> BTW, is JDOHelper.shallowCopy() supposed to work only on a =20 >> detached graph or on any persistence capable object? >> Regards, >> J=F6rg >> > > > --=20 > Michael Bouschen Tech@Spree Engineering GmbH > mailto:mbo.tech@spree.de http://www.tech.spree.de/ > Tel.:++49/30/235 520-33 Buelowstr. 66 > Fax.:++49/30/2175 2012 D-10783 Berlin >