Return-Path: Delivered-To: apmail-db-jdo-dev-archive@www.apache.org Received: (qmail 13800 invoked from network); 6 Aug 2007 05:09:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Aug 2007 05:09:05 -0000 Received: (qmail 4374 invoked by uid 500); 6 Aug 2007 05:09:05 -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 4363 invoked by uid 99); 6 Aug 2007 05:09:05 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Aug 2007 22:09:05 -0700 X-ASF-Spam-Status: No, hits=4.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of cbeams@gmail.com designates 209.85.198.189 as permitted sender) Received: from [209.85.198.189] (HELO rv-out-0910.google.com) (209.85.198.189) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2007 05:08:58 +0000 Received: by rv-out-0910.google.com with SMTP id b22so896502rvf for ; Sun, 05 Aug 2007 22:08:38 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:from:subject:date:to:x-mailer; b=t2ZX+6r3oXaPA9T457fhG2ZTO4Rydz4UmbnVa58BjqYTZjs/yn8rnlvVPWPmlfjye5LzEYxoDSQzSUEFRfNCwy5RTsBmRtT02fDX66MQF7Uspwolatonub5I+r5pTIdaGdjvpC4/qO8+dKtOrJjrApVk26Ybh4SuD8fHZnUDW3o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:from:subject:date:to:x-mailer; b=tqAwwZe/69oQzdxWusLjNGQ4DcU1j3SXaZoS7nRpM+Cv+MYZQYhDuj8cG0XaS9SjU/tbMn3ghbsIXcqiin4F85X7sD4++DvXzZ6+b8jL1tGRX+gbjg06oH6Tr5brngvTOTCWicCJcmcETfqSsQgpetEP35wSaSCtkjguHqWVufI= Received: by 10.114.159.1 with SMTP id h1mr5255470wae.1186376918223; Sun, 05 Aug 2007 22:08:38 -0700 (PDT) Received: from ?192.168.1.100? ( [71.197.234.242]) by mx.google.com with ESMTPS id n22sm10685105pof.2007.08.05.22.08.29 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 05 Aug 2007 22:08:31 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v752.3) In-Reply-To: <45CA023F-9583-4BA6-BD8F-1A2F7149F5C2@gmail.com> References: <45CA023F-9583-4BA6-BD8F-1A2F7149F5C2@gmail.com> Content-Type: multipart/alternative; boundary=Apple-Mail-102--236133112 Message-Id: <327A6464-2DF1-482A-8342-6E931DD9B48A@gmail.com> From: cbeams Subject: Re: 2.1 Spec: detached-dirty parameters to makePersistent() when DetachAllOnCommit=true Date: Sun, 5 Aug 2007 22:09:40 -0700 To: jdo-dev@db.apache.org, JDO Expert Group X-Mailer: Apple Mail (2.752.3) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-102--236133112 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed My previous email on this topic was a bit verbose, and I later realized contained some inaccuracies. Keeping things as succinct as possible, is there any reason the spec couldn't be amended to support the following code? package com.xyz; import org.apache.log4j.Logger; import javax.jdo.*; import static javax.jdo.JDOHelper.*; public class Main { public static final Logger logger = Logger.getLogger(Main.class); public static void main(String... args) { PersistenceManagerFactory pmf = JDOHelper.getPersistenceManagerFactory("jpox.properties"); PersistenceManager pm = pmf.getPersistenceManager(); assert pm.getDetachAllOnCommit() == true; A parameter = new A(); A returned; logger.info("making newly created parameter instance persistent"); pm.currentTransaction().begin(); returned = pm.makePersistent(parameter); pm.currentTransaction().commit(); assert parameter == returned; assert isDetached(parameter) && !isDirty(parameter); logger.info("dirtying parameter instance"); parameter.setName("mud"); assert isDetached(parameter) && isDirty(parameter); logger.info("reattaching dirtied parameter instance"); pm.currentTransaction().begin(); returned = pm.makePersistent(parameter); pm.currentTransaction().commit(); // these assertions currently fail assert parameter == returned; assert isDetached(parameter) && !isDirty(parameter); } } @javax.jdo.annotations.PersistenceCapable(detachable = "true") class A { private String name; public void setName(String name) { this.name = name; } } Thanks, - Chris Beams --Apple-Mail-102--236133112--