Re: Newbie: DataObject declaration and commit

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Dec 15 2005 - 11:38:17 EST

  • Next message: Steve Wells: "1.2M9 - Windows Modeler startup issue"

    > So what's the difference between the two object decalrations ?

    Andrea, it is not clear from your example how the first object is
    initialized and later manipulated. This advice is a shot in the dark,
    but one way to keep a transient object around is to create and
    register an object, and then delete it from DataContext right before
    the commit.

    Andrus

    On Dec 15, 2005, at 4:23 PM, Andrea Borgogelli Avveduti wrote:
    > // Example (not real code):
    >
    > .....
    > public MyCayenneDataClass myCayenneDataObject;
    > .....
    > MyCayenneDataClass myCayenneDataObject2= ( MyCayenneDataClass )
    > dataContext.createAndRegisterNewObject( MyCayenneDataClass.class );
    > .....
    > datacontext.commitChanges();
    >
    >
    > // Question is:
    >
    > /*
    >
    > Why the Cayenne try to insert to records in the DB. I don't want to
    > insert myCayenneDataObject but only myCayenneDataObject2. I'd like
    > to use the first object only for temporary data.
    > So what's the difference between the two object decalrations ?
    >
    > Thank you all for any help
    >
    > Andrea.
    >
    > */



    This archive was generated by hypermail 2.0.0 : Thu Dec 15 2005 - 11:38:20 EST