cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Detlef Burt <>
Subject Replace Objects in a Database?
Date Thu, 29 Nov 2007 11:33:23 GMT

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 ?

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.


View raw message