Welcome Nikolai !
If I get you right, you want to commit data regardless of validation,
but log all validation exceptions.
You can call validateForSave() manually, get the failures, and than
commit with setValidatingObjectsOnCommit flag off.
Marcin
PS: this might be helpful http://objectstyle.org/confluence/display/
CAYDOC/DataObject+Validation
On 28/06/2006, at 5:01 PM, Nikolai Raitsev wrote:
> Hello
> I am new here
> and sorry for my English:)
>
> I have searched the mailing lists, but not found possible answer
> for my
> question.
> Here is my question, maybe everybody can help me:
>
> how can I execute commitChanges()-Method, with a lot of
> ValidationExceptions?
>
> For the moment I implemented validateForSave-Method for my
> CayenneDataObject.
>
> the following happens:
>
> I have 2 tables: 1. table with 1000 datasets and 2. table without
> data.
>
> on DataObject from 2. table i have validateForSave-method
>
> if i copy data from 1.table into 2.table and make commit like this:
> try
> {
> dataContext.commitChanges();
> }
> catch(ValidationException vex)
> {
> System.out.println(vex.getValidationResult().getFailures().size());
> }
> i have a correct number from validation faults... but the 2.table
> is empty.
>
> if i call (before commitChanges())
> dataContext.setValidatingObjectsOnCommit(false);
>
> then i have 1000 datasets in second table, but no information above
> the
> validation faults
>
> Wat can I do? I need the data in 2. table and the information about
> validation faults I would like only log...
>
> i hope i have my question clear verbalized...
> thanks for help,
>
> Nikolai Raitsev
-------------------------->
ish
http://www.ish.com.au
Level 1, 30 Wilson Street Newtown 2042 Australia
phone +61 2 9550 5001 fax +61 2 9550 4001
This archive was generated by hypermail 2.0.0 : Wed Jun 28 2006 - 03:35:59 EDT