Return-Path: Delivered-To: apmail-incubator-open-jpa-dev-archive@locus.apache.org Received: (qmail 50896 invoked from network); 8 Nov 2006 02:58:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2006 02:58:29 -0000 Received: (qmail 83128 invoked by uid 500); 8 Nov 2006 02:58:40 -0000 Delivered-To: apmail-incubator-open-jpa-dev-archive@incubator.apache.org Received: (qmail 83094 invoked by uid 500); 8 Nov 2006 02:58:40 -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 83085 invoked by uid 99); 8 Nov 2006 02:58:40 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Nov 2006 18:58:40 -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; Tue, 07 Nov 2006 18:58:25 -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 kA82w0Bv022489 for ; Tue, 7 Nov 2006 18:58:00 -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 <0J8E00J015K4AR00@d1-sfbay-09.sun.com> (original mail from Craig.Russell@Sun.COM) for open-jpa-dev@incubator.apache.org; Tue, 07 Nov 2006 18:58:00 -0800 (PST) Received: from [192.168.0.10] (c-24-6-172-77.hsd1.ca.comcast.net [24.6.172.77]) by d1-sfbay-09.sun.com (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPSA id <0J8E00LYO5KN1P10@d1-sfbay-09.sun.com> for open-jpa-dev@incubator.apache.org; Tue, 07 Nov 2006 18:58:00 -0800 (PST) Date: Tue, 07 Nov 2006 18:57:54 -0800 From: Craig L Russell Subject: Re: Replacing Entities while Managed In-reply-to: <7230848.post@talk.nabble.com> Sender: Craig.Russell@Sun.COM To: open-jpa-dev@incubator.apache.org Message-id: MIME-version: 1.0 X-Mailer: Apple Mail (2.752.2) Content-type: multipart/signed; protocol="application/pkcs7-signature"; boundary=Apple-Mail-120--36117882; micalg=sha1 References: <7229110.post@talk.nabble.com> <6C28A3C7-DEA4-44CB-8000-B384ADCA2745@SUN.com> <7230848.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-120--36117882 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Hi Don, The merge operation takes as a parameter a detached instance, not a new instance. TopLink Essentials might not be able to tell the difference between a detached and a new instance. So it might work in that environment. But the behavior you're describing is not portable. Is there a way to detach an instance with the identity you want to merge, and update that instance? Then you would have a portable application. Craig On Nov 7, 2006, at 4:55 PM, DonBrady wrote: > > Surely. > > > (1) We do a find method which returns an entity A from the database. > > (2) We also have an unmanaged entity instance B separately, that we > created > outside any persistence context, whose values we wish to use to > update those > in A, and then rewrite A to the database. > > (3) We just set the key of B to that of A (namely "48") and do a > "merge." > This worked to update A in TopLink Essentials. > > (4) Under OpenJPA, we get the exact error message: > >> An object of type "com.xxx.entity.entities.FeCmeCommittee" with oid >> "48" >> already exists in this context; another cannot be persisted. >> > > (5) This seems wrong. The reason the two objects have the same id is > precisely that we want to update the existing entity. > > > THANK YOU. > > Don > > > > Craig L Russell wrote: >> >> Hi Don, >> >> Could you please be just a bit more specific about what you are >> trying to do and what error you encounter? >> >> Thanks, >> >> Craig >> >> On Nov 7, 2006, at 2:50 PM, DonBrady wrote: >> >>> >>> We are converting a TopLink Essentials application to OpenJPA >>> >>> Under Toplink Essentials, we could replace a managed entity with >>> another >>> that had the same identity (key) by doing a merge. >>> >>> When we try this in OpenJPA, we get the following error: >>> >>> An object of type "com.xxx.entity.entities.FeCmeCommittee" with oid >>> "48" >>> already exists in this context; another cannot be persisted. >>> >>> However, "48" is actually the identity or key, not the oid. The >>> oid's are >>> different. They key is the same and therefore it should be >>> possible to >>> replace it via a merge. >>> >>> Or am I missing something? >>> >>> Thanks, >>> >>> Don >>> >>> >>> -- >>> View this message in context: http://www.nabble.com/Replacing- >>> Entities-while-Managed-tf2592059.html#a7229110 >>> Sent from the open-jpa-dev mailing list archive at Nabble.com. >>> >> >> 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! >> >> >> >> > > -- > View this message in context: http://www.nabble.com/Replacing- > Entities-while-Managed-tf2592059.html#a7230848 > Sent from the open-jpa-dev mailing list archive at Nabble.com. > 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-120--36117882 Content-Transfer-Encoding: base64 Content-Type: application/pkcs7-signature; name=smime.p7s Content-Disposition: attachment; filename=smime.p7s MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIGUDCCAwkw ggJyoAMCAQICEB7Y7fLHmKoeHTUdbtYrvpAwDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UEBhMCWkEx JTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQ ZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA1MTIxNTIxNDc0NFoXDTA2MTIxNTIxNDc0 NFowbDEQMA4GA1UEBBMHUnVzc2VsbDEUMBIGA1UEKhMLQ3Jh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