Thanks for replying Mike,
Lets say I use commons validator and then when I press commitChanges the Cayenne Validation Exception is thrown and an jsp error page apprears. On this page would I need to rollback the transaction here? and if I don't roll back anything, will there be any unreleased locks on some records?
-----Original Message-----
From: Mike Kienenberger [mailto:mkienen..laska.net]
Sent: Tuesday, February 22, 2005 12:58 PM
To: cayenne-use..bjectstyle.org
Cc: cayenne-use..bjectstyle.org
Subject: Re: Validation Questions
Fredrik Liden <flide..ranslate.com> wrote:
> Could someone give me some pointers on how to use Validation in a
> project? If it's recommended at all.
>
> I have one jsp with a form and a servlet that processes an add action.
> How would I use validation in this case?
>
> Wrap the add part with a try and catch? and requestdispatcher.
> How would I track down failurs to individual objects to create a more
> descriptive error message? Using if then statements? I'm sure there's a
> better way right?
Normally you perform validation and type conversion in your form processing
logic. How that's done depends on what web app framework you're using.
Commons Validator is one way to do this:
http://jakarta.apache.org/commons/validator/
> Also, if the validationException is thrown, do I need to call rollback
> manually or is this done automaticallly?
It's not automatic.
If you want to throw everything out at that point, you'd call rollback
manually.
If you want to try to correct the error and recommit, you could do that as
well.
-Mike
This archive was generated by hypermail 2.0.0 : Tue Feb 22 2005 - 16:10:56 EST