From jdo-dev-return-2042-apmail-db-jdo-dev-archive=www.apache.org@db.apache.org Tue Nov 01 23:48:31 2005 Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 1518 invoked from network); 1 Nov 2005 23:48:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Nov 2005 23:48:31 -0000 Received: (qmail 18060 invoked by uid 500); 1 Nov 2005 23:48:30 -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 18049 invoked by uid 99); 1 Nov 2005 23:48:30 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Nov 2005 15:48:30 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [62.240.242.88] (HELO smtp.xcalia.com) (62.240.242.88) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Nov 2005 15:48:25 -0800 Received: from localhost ([127.0.0.1]) by diane with esmtp (Exim 4.52) id 1EX5rJ-0000GQ-ES; Wed, 02 Nov 2005 00:48:07 +0100 Received: from diane ([127.0.0.1]) by localhost (diane [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 18482-08; Wed, 2 Nov 2005 00:48:05 +0100 (CET) Received: from [172.16.0.30] (helo=DELLZILLA) by diane with esmtpa (Exim 4.52) id 1EX5rG-0000Fx-6E; Wed, 02 Nov 2005 00:48:04 +0100 Reply-To: From: "Matthew T. Adams" To: , "'JDO Expert Group'" Date: Tue, 1 Nov 2005 15:47:22 -0800 Organization: Xcalia Message-ID: <000901c5df3e$b0e8a450$1e0010ac@DELLZILLA> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.6626 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670 In-Reply-To: X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at xcalia.com X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: matthew.adams@xcalia.com Subject: RE: Issue 135: Remove attachCopy from PersistenceManager X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on diane X-Spam-Level: X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on diane) X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,AWL autolearn=failed version=3.0.4 X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N +1! I really like this proposal from a user's perspective. >-----Original Message----- >From: Craig.Russell@Sun.COM [mailto:Craig.Russell@Sun.COM] >Sent: Tuesday, November 01, 2005 3:38 PM >To: JDO Expert Group; jdo-dev@db.apache.org >Subject: Issue 135: Remove attachCopy from PersistenceManager > > >Javadogs, > >Please comment on this proposal. > >There are so few differences between makePersistent and attachCopy, >it's confusing. The only significant differences between the APIs is >in the treatment of transient instances. MakePersistent makes >transient instances transition to persistent-new; attachCopy copies >transient instances. > >The proposal is to remove attachCopy, change the signature of >makePersistent and makePersistentAll to return the instance(s), and >add a method to JDOHelper. > >The semantics of makePersistent change slightly from the >specification. Currently, detached instances in the object graph >cause an exception to be thrown. With this change, detached instances >are located in the persistent cache and any dirty fields are applied >to the persistent instance. > >With this change, there is no standard way to attach the same object >graph to multiple persistence managers. So a method is added to >JDOHelper that copies a complete object graph so the copies can be >attached to multiple persistence managers. > >Instead of: >Object[ ] attached1 = pm.attachCopy(graph); >Object[ ] attached2 = pm.attachCopy(graph); > >use: >Object[ ] copies = JDOHelper.shallowCopy(graph, false); >Object[ ] attached1 = pm.makePersistentAll(copies); >Object[ ] attached2 = pm.makePersistentAll(copies); > >The signatures of shallowCopy are: >Object shallowCopy(Object original, boolean copyTransientFields); >Collection shallowCopyAll(Collection original, boolean >copyTransientFields); >Object[ ] shallowCopy(Object[ ] original, boolean copyTransientFields); > >The copyTransientFields parameter specifies whether to copy the >transient fields of detached and transient instances. True requires >that the JDOHelper be given security privileges to allow reflective >copy. Non-binary-compatible implementations also require security >privileges. Binary-compatible implementations will use the support >for PersistenceCapable to copy the fields. > >Support for deep copies is left to the implementation, as there is no >standard way to deep copy. > >Craig > > >Craig Russell >Architect, Sun Java Enterprise System http://java.sun.com/products/jdo >408 276-5638 mailto:Craig.Russell@sun.com >P.S. A good JDO? O, Gasp! > >