Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 54633 invoked from network); 12 Mar 2009 07:41:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Mar 2009 07:41:46 -0000 Received: (qmail 99678 invoked by uid 500); 12 Mar 2009 07:41:45 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 99660 invoked by uid 500); 12 Mar 2009 07:41:45 -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 99649 invoked by uid 99); 12 Mar 2009 07:41:45 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 00:41:45 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of niparasc@gmail.com designates 209.85.219.161 as permitted sender) Received: from [209.85.219.161] (HELO mail-ew0-f161.google.com) (209.85.219.161) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2009 07:41:36 +0000 Received: by ewy5 with SMTP id 5so306837ewy.4 for ; Thu, 12 Mar 2009 00:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=rLE3W1eCj9G3gIa2K44JO3ks2UHa4dvtk490r0477Mg=; b=vhOBLxIdu/Hmrk3Y/bEcs2xKdptVm6NWYP7ioVO0BVt3CrljX31VxUm1at4TZmWihy ZiQ+bgTu6qJGBXcD/Uj69/zSVy3sTEHDtr9t97AW/x6226rNm+5bxmWtkzC0U3Fdh/gN r73S9rp5EPIHCVToY5/Nvj05jllmSfnVoEKsQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:in-reply-to:references:content-type:date:message-id :mime-version:x-mailer:content-transfer-encoding; b=LXzg4NwdTrx2nE0YNJd1GEU8r6EOuwBaMzrz51DS1U1kff9qADaGmcyUHyO00av5ui /6SD8Dtu/EQSd/lMu32rSYVbTDR5+rSeHvLX3ipduXtVZqP+dsyvti2WdrAvAa2g4Q/+ AtXGKabtvfOxJsuIbIt40fNjBqV8iq8lzgHwU= Received: by 10.210.128.5 with SMTP id a5mr6270466ebd.8.1236843675414; Thu, 12 Mar 2009 00:41:15 -0700 (PDT) Received: from ?192.168.1.159? (ppp-94-69-210-17.home.otenet.gr [94.69.210.17]) by mx.google.com with ESMTPS id h6sm644489nfh.55.2009.03.12.00.41.13 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 12 Mar 2009 00:41:14 -0700 (PDT) Subject: Re: How can I handle validation exception? From: =?UTF-8?Q?=CE=9D=CE=AF=CE=BA=CE=BF=CF=82_?= =?UTF-8?Q?=CE=A0=CE=B1=CF=81=CE=AC=CF=83=CF=87=CE=BF=CF=85?= To: user@cayenne.apache.org In-Reply-To: <2EB09FB0-7DF5-48E8-8C26-A74A6020670D@objectstyle.org> References: <1236697433.6175.5.camel@nikp-diaamath> <1236756996.6168.7.camel@nikp-diaamath> <1236762112.6168.24.camel@nikp-diaamath> <2EB09FB0-7DF5-48E8-8C26-A74A6020670D@objectstyle.org> Content-Type: text/plain; charset="UTF-8" Date: Thu, 12 Mar 2009 09:41:11 +0200 Message-Id: <1236843671.6147.11.camel@nikp-diaamath> Mime-Version: 1.0 X-Mailer: Evolution 2.24.3 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org validatingObjectsOnCommit is true and there are changes in the context. The overrided method validateForSave, in the object class produced by cayenne modeller, is called. The problem is that commitChanges() doesn't throw directly a ValidationException so I cannot catch it in the catch block (it throws a CayenneRuntimeException). How should I handle this exception? I need validationResult in order to call getFailures(). How can I retrieve validationResult? Maybe I am missing something... Thank you, Nikos Στις 11-03-2009, ημέρα Τετ, και ώρα 15:06 +0200, ο/η Andrus Adamchik έγραψε: > On Mar 11, 2009, at 11:01 AM, Νίκος Παράσχου wrote: > > > Is there any way to do something like the following: > > > > try { > > context.commitChanges(); > > } > > catch(Some ValidationException thrown earlier) { > > // Get failures list and print error messages. > > } > > This is how it should be done, and this works for me at least. Not > sure why it does not work for you. Can you doublecheck that > validatingObjectsOnCommit is actually true and there are changes in > the context? > > Andrus