Hello,
I have a question about the "validateForInsert,
validateForUpdate, validateForDelete" methods.
I'm not sure when is the right time to call them.
What I did is I just call them prior to calling
datacontext's commitChanges(). If the validation
result is
empty, then proceed with commitChanges(). Am I right?
For validateForUpdate(), this is what I did:
1. Obtain the record from database
2. Update necessary properties
3. Call validateForUpdate()
4. if validation result is empty, then proceed with
data context's commitChanges().
For validateForDelete():
1. Obtain the record from database
2. Call validateForDelete()
3. If validation result is empty, call data context's
deleteObject, then commitChanges().
Is this correct? Is it worth to perform these
validation, or is it necessary just to leave it to
DataContext's commitChanges(), and catch the
CayenneRuntimeException if anything goes wrong?
Also, there is something wrong with the way I call
validateForDelete() above. Sometimes, although the
validation result is empty, I still encountered
cayenneruntime exception when performing
commitChanges() (usually because of the foreign key
constraints). In this case, what is
validateForDelete() for??? or.. do i have to check it
manually, since the API says that validateForDelete()
does nothing?
Thanks a lot for the help, and apology for the basic
question..
Best regards,
=====
Alex Wibowo
~ Second is a failure ~
==============================================
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
This archive was generated by hypermail 2.0.0 : Wed Dec 22 2004 - 23:36:15 EST