cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: How can I handle validation exception?
Date Tue, 10 Mar 2009 16:16:38 GMT
The code example looks about right. However this is probably what's  
wrong: "When a specific condition is not met, a ValidationException is  
thrown.". You should not throw the exception yourself. Just add an  
error to the validationResult, and let Cayenne throw it later.

Andrus


On Mar 10, 2009, at 5:03 PM, Νίκος Παράσχου wrote:

> Hello,
>
> I implemented validateForSave(ValidationResult validationResult) in  
> one
> of my ObjEntities. When a specific condition is not met, a
> ValidationException is thrown.
>
> How can I handle this ValidationException?
>
> The following doesn't work (I get: ValidationException is not thrown
> anywhere inside block try{}):
>
> try {
> 	mycontext.commit();
> }
> catch(ValidationException vex) {
> 	...
> }
>
> Thank you,
> Nikos
>
>
>


Mime
View raw message