Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 72337 invoked from network); 14 Feb 2010 21:01:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 14 Feb 2010 21:01:29 -0000 Received: (qmail 82689 invoked by uid 500); 14 Feb 2010 21:01:28 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 82665 invoked by uid 500); 14 Feb 2010 21:01:28 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 82655 invoked by uid 99); 14 Feb 2010 21:01:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Feb 2010 21:01:28 +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 razumovsky.andrey@gmail.com designates 209.85.219.212 as permitted sender) Received: from [209.85.219.212] (HELO mail-ew0-f212.google.com) (209.85.219.212) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 14 Feb 2010 21:01:20 +0000 Received: by ewy4 with SMTP id 4so60116ewy.27 for ; Sun, 14 Feb 2010 13:01:00 -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 :from:date:message-id:subject:to:content-type; bh=cy2CKTchVd2KdzaqMDMaGRiCwFtziQGzTL6jqENxlIo=; b=uvL654teyns7iLtfFyNzlcqrz9nFYTXcoz7+VZDqCpgG24EBh8BjMXmyDFoX3zOpsw 34/nMBin3B/joUfyVYZqblloxDvDRTB5S6YOQO5702tfC+59b0W9Ip1jauWBbshC/4zH Q3UDA2C377Fgzud+K8aBbQhAJbC+LLB2LKjMM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=syESONfzARteHuKhRX/FpPKFrmKpRTEWtyk80fAFQG8Q9+FxuDNi+QU9xXUuH+nfii vOUgHfenK61suopiJ1l6axZxr/Mrcx/XycMYFuWfyATH08Ov/Gr5GG2Z53jgMsxfP5ZD v2ZDSa/SWKMZHa2PLkwtNqN65ko4Mle1rUBA8= MIME-Version: 1.0 Received: by 10.216.88.14 with SMTP id z14mr273703wee.25.1266181260172; Sun, 14 Feb 2010 13:01:00 -0800 (PST) In-Reply-To: <4B758D6B.1070008@buk.cvut.cz> References: <4B758D6B.1070008@buk.cvut.cz> From: Andrey Razumovsky Date: Mon, 15 Feb 2010 00:00:40 +0300 Message-ID: <3219fff71002141300m47babec2haf0aefe57bae84f3@mail.gmail.com> Subject: Re: Rolling back vs deleteobject To: user@cayenne.apache.org Content-Type: multipart/alternative; boundary=0016e6d7e9253bdfe3047f95ccb5 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d7e9253bdfe3047f95ccb5 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, The example is correct. If something's gone wrong during the commit, you'll need to roll back so that bad data will not be present in next commit (assuming you're using WebApplicationContextFilter). In WebApplicationContextFilter there is one context per session. rollbackChangesLocally() is used to clean only nested context, without affecting parent context. If you're not creating nested contexts, it works same as rollbackChanges() 2010/2/12 Marek =C5=A0abo > Hi all, > > I would like to know your opininon on this (example adding user): > > try { > getObjectContext().commitChanges(); > return user; > } catch (CayenneRuntimeException cre) { > //getObjectContext().deleteObject(u); > getObjectContext().rollbackChanges(); > } > > I was using deleteObject method but that didn't reccure so foreign key > objects were left just like that in context, rollback does the trick for = me. > I'm not sure how exactly this rollback works when I'm using > getThreadObjectContext - will it be unique for every user session on > webserver?? I hope it's not shared amongst them. And what's the differenc= e > from the "local" version of rollback? > > Thanks in advance, > > regards, > > Marek > --=20 Andrey --0016e6d7e9253bdfe3047f95ccb5--