Return-Path: Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: (qmail 29154 invoked from network); 3 Dec 2009 14:56:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Dec 2009 14:56:33 -0000 Received: (qmail 40949 invoked by uid 500); 3 Dec 2009 14:56:32 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 40904 invoked by uid 500); 3 Dec 2009 14:56:32 -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 40894 invoked by uid 99); 3 Dec 2009 14:56:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 14:56:32 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of curtisr7@gmail.com designates 209.85.210.177 as permitted sender) Received: from [209.85.210.177] (HELO mail-yx0-f177.google.com) (209.85.210.177) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Dec 2009 14:56:23 +0000 Received: by yxe7 with SMTP id 7so1268500yxe.25 for ; Thu, 03 Dec 2009 06:56:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=7ZjwjS0inCN5Zp2AyN8eAdOE1rGiIYI1FaZIFwLwVFY=; b=UATHQr7NJ0dEhPR4oWMdKbRnzkeGGNdmTNC2oisSaP4Tp5PJo9HmFKyem2rIDESrqu edfwQZvfCS5znKPvqg7O6NW7ivgv4IiALwkNLtXiGAY+QJCbYpD0lAbBc9miDmzTC+w2 myV7CMC6MhA7femF4yrZwSxBhgnJGd6Or5Uz0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=KnSt9PgnciRoY0Oa25xo+o9PJqt8Z70KAWwbqtJw/cmrYwjAQBV4/vPixCZeXLPUBP pAHz6myhKW34lFRWXJSV/LrAKu8frV7KQyv1LFGj1IE3tb3nP09IJnwG9vTRXKJiD8QO koRHzh2OM4/APe5ZkjbK4ovqHAjtlpKlOHB/8= MIME-Version: 1.0 Received: by 10.150.125.3 with SMTP id x3mr3097264ybc.28.1259852159683; Thu, 03 Dec 2009 06:55:59 -0800 (PST) In-Reply-To: <29FD8F5F-E7DE-479C-A9E6-2735B8858BFF@novlog.com> References: <29FD8F5F-E7DE-479C-A9E6-2735B8858BFF@novlog.com> Date: Thu, 3 Dec 2009 08:55:59 -0600 Message-ID: Subject: Re: detach question From: Rick Curtis To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=000e0cd6a7f8728f8f0479d43040 X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd6a7f8728f8f0479d43040 Content-Type: text/plain; charset=ISO-8859-1 When you call cc.merge(ooo); any changes made to that instance while it was detached will be persisted to the DB. 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. -- Thanks, Rick On Thu, Dec 3, 2009 at 8:49 AM, Jean-Baptiste BRIAUD -- Novlog < j-b.briaud@novlog.com> wrote: > Hi the list, > > Am i right on the following pseudo code ? > > // Note the detach. > // getFullById come back with an instance of MyObject from the > primary key > final MyObject ooo = detach(getFullById(cc.... > > < Here I modify (a lot) ooo but don't wan't the modif to be > persist> > > try { > cc.beginTransaction(); > > persist, not the other one before> > > cc.merge(ooo); > cc.commitTransaction(); > > } catch (...) { > cc.rollbackTransaction(); > } > > Thanks ! --000e0cd6a7f8728f8f0479d43040--