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 <syrinx200..mail.com> 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.
This archive was generated by hypermail 2.0.0 : Wed Mar 14 2007 - 16:32:04 EDT