Hi all.

I’m attempting to implement an audit log using Cayenne, automatically storing 
information on modifications alongside every insert, update and delete.

I’m currently doing this by adding a listener on the DataDomain that watches 
for the lifecycle events PrePersist, PreUpdate and PreRemove, and there I log 
what’s happening with the objects. Works perfectly.

One thing I’m wondering though. How can I find what has changed in an object in 
PreUpdate (i.d. when logging modifications)? For those familiar with EOF, I do 
it there by looking at the EOEditingContext’s.commitedSnapshotForObject() and 
comparing the values found there with the object’s current values—but I can’t 
find how to to do something similar in Cayenne.

Am I maybe going about this in a completely wrong way (and there’s perhaps a 
much better, more Cayenne-ish way to do this)? If so, I’d be grateful if 
someone could point me in the correct direction :).

Thanks once again,
- hugi

// Hugi Thordarson
// http://www.loftfar.is/ <http://www.loftfar.is/>
// s. 895-6688

Reply via email to