Replace Objects in a Database?

From: Detlef Burt (the.freakazoi..mx.net)
Date: Thu Nov 29 2007 - 06:33:23 EST

  • Next message: Tore Halset: "cayenne modeler problem on windows"

    Hello,

    after being able to keep my Data after sending my Objects via JMS
    (Thanks Andrus) I now have a problem when I try to write the Objects
    back into the Database.

    After sending the Objects to the Client-Application, the Client changes
    some data ( Just a timestamp in my Testcase ) and then sends an
    Update-Request to the Server. Due to the fact, that the Client has no
    access to the DataContext or the underlying ObjectStore, the changes
    made to the Object won't be recorded.
    After the Server receives the Object, it reconnects the Object to the
    DataContext, thus being able to get a snapshot from the database or even
    create an UpdateQuery.
    But I can't go anywhere from here.
    Executing the UpdateQuery won't have any effect because Cayenne doesn't
    know what changed.

    I also tried to get a Snapshot from the DB, convert my DataObject to a
    DataRow and then create and register the diff of those by myself. But I
    couldn't find anything like that :/

    To sum it all up:
    - Can I tell Cayenne to replace the Database Contents with the data from
    my Object while retaining the ObjectId ?
    - Can I tell Cayenne to "scan" an Object for changes and register the
    differences, so that calling commitChanges will update the Object?
    - Or is it possible to create a DataRow from a DataObject so I can
    create and register an ObjectDiff ?

    NOTE:
    When updating the Object, I don't know what class is being updated and
    what properties it has, all I have is my CayennePersistableObject
    Baseclass, which extends CayenneDataObject.

    Detlef



    This archive was generated by hypermail 2.0.0 : Thu Nov 29 2007 - 06:34:41 EST