commitChanges and ValidationExceptions

From: Nikolai Raitsev (nikolai.raitse..mail.com)
Date: Wed Jun 28 2006 - 03:01:18 EDT

  • Next message: Marcin Skladaniec: "Re: commitChanges and ValidationExceptions"

    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



    This archive was generated by hypermail 2.0.0 : Wed Jun 28 2006 - 03:01:45 EDT