Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 77330 invoked from network); 5 Dec 2009 10:36:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Dec 2009 10:36:08 -0000 Received: (qmail 11264 invoked by uid 500); 5 Dec 2009 10:36:08 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 11191 invoked by uid 500); 5 Dec 2009 10:36:07 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 11181 invoked by uid 99); 5 Dec 2009 10:36:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Dec 2009 10:36:06 +0000 X-ASF-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [213.186.62.213] (HELO 30.mail-out.ovh.net) (213.186.62.213) by apache.org (qpsmtpd/0.29) with SMTP; Sat, 05 Dec 2009 10:36:04 +0000 Received: (qmail 27500 invoked by uid 503); 5 Dec 2009 10:35:35 -0000 Received: from b6.ovh.net (HELO mail621.ha.ovh.net) (213.186.33.56) by 30.mail-out.ovh.net with SMTP; 5 Dec 2009 10:35:35 -0000 Received: from b0.ovh.net (HELO queueout) (213.186.33.50) by b0.ovh.net with SMTP; 5 Dec 2009 10:36:37 -0000 Received: from mol92-1-82-67-218-223.fbx.proxad.net (HELO ?172.16.1.10?) (j-b.briaud%novlog.com@82.67.218.223) by ns0.ovh.net with SMTP; 5 Dec 2009 10:36:36 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1077) Subject: Re: detach question From: Jean-Baptiste BRIAUD -- Novlog In-Reply-To: Date: Sat, 5 Dec 2009 11:35:39 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: References: <29FD8F5F-E7DE-479C-A9E6-2735B8858BFF@novlog.com> To: users@openjpa.apache.org X-Mailer: Apple Mail (2.1077) X-Ovh-Tracer-Id: 4013833168118276134 X-Ovh-Remote: 82.67.218.223 (mol92-1-82-67-218-223.fbx.proxad.net) X-Ovh-Local: 213.186.33.20 (ns0.ovh.net) X-Spam-Check: DONE|U 0.5/N it work as you said, a second request is needed. Thanks ! On Dec 3, 2009, at 15:55 , Rick Curtis wrote: > When you call cc.merge(ooo); any changes made to that instance while = it was > detached will be persisted to the DB. >=20 > I assume your comment "Here I modify the ooo but I want this modif to = be > persist, not the other one before" means that you only want the = changes from > after the tran begins to be persistent... If that assumption is = correct, > you'll need to get a new instance of ooo to make the changes on. > --=20 > Thanks, > Rick >=20 > On Thu, Dec 3, 2009 at 8:49 AM, Jean-Baptiste BRIAUD -- Novlog < > j-b.briaud@novlog.com> wrote: >=20 >> Hi the list, >>=20 >> Am i right on the following pseudo code ? >>=20 >> // Note the detach. >> // getFullById come back with an instance of MyObject from = the >> primary key >> final MyObject ooo =3D detach(getFullById(cc.... >>=20 >> < Here I modify (a lot) ooo but don't wan't the modif to be >> persist> >>=20 >> try { >> cc.beginTransaction(); >>=20 >> > persist, not the other one before> >>=20 >> cc.merge(ooo); >> cc.commitTransaction(); >>=20 >> } catch (...) { >> cc.rollbackTransaction(); >> } >>=20 >> Thanks !