Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 45975 invoked from network); 31 Jul 2007 14:06:48 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Jul 2007 14:06:48 -0000 Received: (qmail 96541 invoked by uid 500); 31 Jul 2007 14:06:48 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 96532 invoked by uid 500); 31 Jul 2007 14:06:48 -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 96523 invoked by uid 99); 31 Jul 2007 14:06:48 -0000 Received: from Unknown (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 07:06:48 -0700 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [59.167.240.32] (HELO fish.ish.com.au) (59.167.240.32) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2007 14:06:42 +0000 Received: from [10.29.62.13] (helo=[10.29.62.13]) by fish.ish.com.au with esmtpa (Exim 4.43) id 1IFsKF-0002uA-Tb for user@cayenne.apache.org; Wed, 01 Aug 2007 00:03:54 +1000 Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: References: Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="Apple-Mail-12--722338811" Message-Id: <48A72E79-80D7-42DA-AFF5-FDB6BBB6D630@maniatis.org> Content-Transfer-Encoding: 7bit From: Aristedes Maniatis Subject: Re: Prevent of commit Date: Wed, 1 Aug 2007 00:06:14 +1000 To: user@cayenne.apache.org X-Pgp-Agent: GPGMail 1.1.2 (Tiger) X-Mailer: Apple Mail (2.752.2) X-Spam-Score: -1.4 (-) X-Spam-Report: -1.4 ALL_TRUSTED Passed through trusted hosts only via SMTP X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-12--722338811 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 31/07/2007, at 11:26 PM, Jan Lendholt wrote: > I created an object via context.newObject(Service.class); > > Before I do a context.commitChanges() I check if there are any > input errors in the input fields that should be set to the object. > If we encounter an exception, we abort the creation / editing of > the current object. > > Now, in the meantime, I take another window to create another > object, like context.newObject(Person.class) and call the > context.commitChanges(). > > Now, the old object, at which the check of the data failed, ist > committed as well. Just to add to Michael's useful comments, what we do is have one 'shared' context which is used to display lots of read only data. These usually represent records in some sort of list (which you double click to edit). This is shared between all open windows and other processes and is only read from. Then each editable window creates its own editing context as needed. This gives a good balance between caching of data (in the big shared context) and small flexible contexts for editing. In the notes above it appears you might be missing the concept of validation in Cayenne. You don't need to validate data before you populate the object. Better to put the data directly into your object entity and then try to commit it. Any validation exceptions can then be properly dealt with by your code and GUI. Ari Maniatis --------------------------> Aristedes Maniatis phone +61 2 9660 9700 PGP fingerprint 08 57 20 4B 80 69 59 E2 A9 BF 2D 48 C2 20 0C C8 --Apple-Mail-12--722338811 content-type: application/pgp-signature; x-mac-type=70674453; name=PGP.sig content-description: This is a digitally signed message part content-disposition: inline; filename=PGP.sig content-transfer-encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iEYEARECAAYFAkavQdcACgkQ72p9Lj5JECqtmQCfaOEUXKRTWm2VKN2bnE0tIiN2 wNYAn0byL/SQk3gVJcPpkeak8Iu9tt1h =EY9/ -----END PGP SIGNATURE----- --Apple-Mail-12--722338811--