Return-Path: Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: (qmail 97749 invoked from network); 14 Mar 2007 20:31:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Mar 2007 20:31:50 -0000 Received: (qmail 40249 invoked by uid 500); 14 Mar 2007 20:31:57 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 40235 invoked by uid 500); 14 Mar 2007 20:31:57 -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 40226 invoked by uid 99); 14 Mar 2007 20:31:57 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Mar 2007 13:31:57 -0700 X-ASF-Spam-Status: No, hits=0.3 required=10.0 tests=MAILTO_TO_SPAM_ADDR,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of lists@nabble.com designates 72.21.53.35 as permitted sender) Received: from [72.21.53.35] (HELO talk.nabble.com) (72.21.53.35) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Mar 2007 13:31:45 -0700 Received: from [72.21.53.38] (helo=jubjub.nabble.com) by talk.nabble.com with esmtp (Exim 4.50) id 1HRa85-0004Bt-1I for user@cayenne.apache.org; Wed, 14 Mar 2007 13:31:25 -0700 Message-ID: <9482825.post@talk.nabble.com> Date: Wed, 14 Mar 2007 13:31:25 -0700 (PDT) From: syrinx To: user@cayenne.apache.org Subject: Re: [s] Cayenne validation In-Reply-To: <8f985b960703141245r3235922bq774d44f1f3eedf43@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: syrinx2004@gmail.com References: <9481842.post@talk.nabble.com> <8f985b960703141245r3235922bq774d44f1f3eedf43@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org Thanks for a quick answer Mike... What you propose could work, however since a ValidationException can be thrown in many different situations, I would have to parse earch error message to detect what cause the error, before I throw a new exception. In the cayenne documentation it says that "Validation failures can be tracked down to the individual objects and their properties, allowing creation of user-friendly, internationalized validation messages", so I was expecting a "clean" way to customize those error messages (using a ResourceBundle or something similar). I am a little disappointed. Mike Kienenberger wrote: > > You haven't said how you want to use it, but at the most basic level, > you could catch the ValidationExceptionand rethrow it with a new > message based on the original message. > > On 3/14/07, syrinx wrote: >> >> Hello, >> >> I have just started "playing around" with Cayenne a couple weeks ago, so >> in >> other words I am a rookie. I am happy with the product so far, but I >> cannot >> figure out how to use the data validation properly. >> >> For example, if I try to commit an object with a missing "mandatory >> field", >> I get a ValidationException. From that exception I can access a >> BeanValidationFailure object which contains the details of the validation >> error (description, source, attribute). The thing is that I would like >> to >> change the generic error messages (ex: field cannot be empty, field >> exceeds >> maximum allowed length) thrown by cayenne and these messages seem to be >> hard >> coded in the sources. >> >> Is there a "clean way" to customize those messages? >> >> Thanks for your help. >> -- >> View this message in context: >> http://www.nabble.com/Cayenne-validation-tf3404355.html#a9481842 >> Sent from the Cayenne - User mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://www.nabble.com/Cayenne-validation-tf3404355.html#a9482825 Sent from the Cayenne - User mailing list archive at Nabble.com.