Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 24061 invoked from network); 5 Feb 2007 23:29:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Feb 2007 23:29:22 -0000 Received: (qmail 59729 invoked by uid 500); 5 Feb 2007 23:29:28 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 59710 invoked by uid 500); 5 Feb 2007 23:29:28 -0000 Mailing-List: contact open-jpa-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: open-jpa-dev@incubator.apache.org Delivered-To: mailing list open-jpa-dev@incubator.apache.org Received: (qmail 59701 invoked by uid 99); 5 Feb 2007 23:29:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Feb 2007 15:29:28 -0800 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=UNPARSEABLE_RELAY X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [192.18.42.249] (HELO nwk-ea-fw-1.sun.com) (192.18.42.249) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Feb 2007 15:29:17 -0800 Received: from d1-sfbay-09.sun.com ([192.18.39.119]) by nwk-ea-fw-1.sun.com (8.13.6+Sun/8.12.9) with ESMTP id l15NSrMb026289 for ; Mon, 5 Feb 2007 15:28:53 -0800 (PST) Received: from conversion-daemon.d1-sfbay-09.sun.com by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) id <0JD000F01JUWXH00@d1-sfbay-09.sun.com> (original mail from Craig.Russell@Sun.COM) for open-jpa-dev@incubator.apache.org; Mon, 05 Feb 2007 15:28:53 -0800 (PST) Received: from [129.145.133.119] by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0JD000CNNJW4XBB0@d1-sfbay-09.sun.com> for open-jpa-dev@incubator.apache.org; Mon, 05 Feb 2007 15:28:53 -0800 (PST) Date: Mon, 05 Feb 2007 15:28:51 -0800 From: Craig L Russell Subject: Re: EntityManager.clear() semantics In-reply-to: <89c0c52c0701310625n23e9e049k50dccf2e9e57526c@mail.gmail.com> Sender: Craig.Russell@Sun.COM To: open-jpa-dev@incubator.apache.org Message-id: <37B812D4-C0C7-41AE-9CF5-2572CFB07F99@SUN.com> MIME-version: 1.0 X-Mailer: Apple Mail (2.752.2) Content-type: multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-6--862595548; micalg=sha1 References: <89c0c52c0701301432y24fd36dna74225693d124b0c@mail.gmail.com> <468FFE5E-2D80-43DA-9D89-D20C48C95526@SUN.com> <89c0c52c0701310625n23e9e049k50dccf2e9e57526c@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-6--862595548 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed I've forwarded the new test case to our CTS team here. They will take a look to see if it can be adapted to the CTS test framework. Craig On Jan 31, 2007, at 6:25 AM, Kevin Sutter wrote: > Craig, > If anybody would have a channel to the CTS team, I would think it > would be > you. :-) I have also passed on this request to our CTS rep to see > where it > takes us. Good idea. Thanks. > > Kevin > > On 1/30/07, Craig L Russell wrote: >> >> Hi Kevin, >> >> I agree with your analysis. >> >> I would also like to see a CTS test made for this case. Do we have a >> channel through BEA or IBM for requests for CTS test cases? >> >> Another recent example is the EntityManager.getDelegate behavior >> which surely should be a candidate for a CTS test. >> >> Craig >> >> On Jan 30, 2007, at 2:32 PM, Kevin Sutter wrote: >> >> > Hi, >> > We've noticed that when EntityManager.clear() is invoked, an >> implicit >> > flush() is performed. Although the spec is cloudy in this area, I >> > don't >> > think this processing is correct. The javadoc is as follows for >> > clear(): >> > >> > /** >> > * Clear the persistence context, causing all managed >> > * entities to become detached. Changes made to entities that >> > * have not been flushed to the database will not be >> > * persisted. >> > */ >> > public void clear(); >> > >> > This indicates that Entities that have not been flushed will not be >> > persisted. Thus, I would say this implies that we should not be >> > doing an >> > implicit flush. If the application wanted their Entities to be >> > flushed >> > before the clear, then they can call the flush() method before >> calling >> > clear(). We shouldn't be doing this for them because then they >> > have no >> > choice. >> > >> > The Pro EJB3 Java Persistence API book has similar wording on pages >> > 138-139: >> > >> > "..In many respects [clear] is semantically equivalent to a >> > transaction >> > rollback. All entity instances managed by the persistence context >> > become >> > detached with their state left exactly as it was when the clear() >> > operation >> > was invoked..." >> > >> > Our current processing for clear() eventually gets to this code: >> > >> > public void detachAll(OpCallbacks call) { >> > beginOperation(true); >> > try { >> > if ((_flags & FLAG_FLUSH_REQUIRED) != 0) >> > flush(); >> > detachAllInternal(call); >> > } catch (OpenJPAException ke) { >> > throw ke; >> > } catch (RuntimeException re) { >> > throw new GeneralException(re); >> > } finally { >> > endOperation(); >> > } >> > } >> > >> > Basically, if we have dirtied the Persistence Context, then do a >> > flush() >> > followed by the detachAllInternal(). I don't think the clear() >> > should be >> > doing this flush() operation. Any disagreement? >> > >> > Thanks, >> > Kevin >> >> 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! >> >> >> >> 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! --Apple-Mail-6--862595548 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUDCCAwkw ggJyoAMCAQICECpJVMO68ii+Xfsc1O1YYFIwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0a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