RE: Update problem

From: Gentry, Michael \(Contractor\) ("Gentry,)
Date: Wed Jan 19 2005 - 13:27:16 EST

  • Next message: Mike Kienenberger: "Re: Update problem"

    Well, since you haven't edited the object, I wouldn't expect Cayenne to save anything, even if the original object in the database has "invalid" data. I would expect the validation routines to only be called for objects that have been edited and need to be saved. Also, keep in mind that if an object has a firstName of "frank" and you do a setFirstName("frank") on it, Cayenne is smart enough to know that the object didn't really change and it will not be flagged as dirty/edited, so nothing would be saved to the database on commit.

    Hope that helps!

    /dev/mrg

    -----Original Message-----
    From: Reinaldo Coelho Sartorelli [mailto:reinaldo.sartorell..ES.com]
    Sent: Wednesday, January 19, 2005 1:18 PM
    To: cayenne-use..bjectstyle.org
    Subject: Update problem

    Iīve a update but this update donīt generate error, and donīt commit information, follow my code:

            public boolean updateSystem(Sys system){
                    try{
                            con.registeredObject(system.getObjectId());
                            con.setValidatingObjectsOnCommit(true);
                            con.commitChanges();
                            return true;
                    }
                    catch(Exception e){
                            con.rollbackChanges();
                            return false;
                    }
            }

    Tanks,
    Reinaldo.

    ________________________________________________________________________
    This communication is for use by the intended recipient and contains information that may be privileged, confidential or copyrighted under law. If you are not the intended recipient, you are hereby formally notified that any use, copying or distribution of this e-Mail, in whole or in part, is strictly prohibited. Please notify the sender by return e-Mail and delete this e-Mail from your system. Unless explicitly and conspicuously stated in the subject matter of the above e-Mail, this e-Mail does not constitute a contract offer, a contract amendment, or an acceptance of a contract offer. This e-Mail does not constitute consent to the use of sender's contact information for direct marketing purposes or for transfers of data to third parties.

    This email has been scanned for all viruses by the MessageLabs service.



    This archive was generated by hypermail 2.0.0 : Wed Jan 19 2005 - 13:27:20 EST