Re: how to catch updates just before commit

From: Mike Kienenberger (mkienen..mail.com)
Date: Fri Apr 28 2006 - 12:44:56 EDT

  • Next message: Andrus Adamchik: "Re: how to catch updates just before commit"

    Take a look at this issue (and the attached thread).

    http://issues.apache.org/cayenne/browse/CAY-414

    I think all of the pieces for this are in place now, but I haven't
    gotten back to try to implement it using the new methodology.

    On 4/28/06, Bryan Lewis <brya..aine.rr.com> wrote:
    > We have a time-when-last-modified timestamp column in most of our tables
    > to serve as an optimistic-locking attribute. At present we're setting
    > it with a bit of inelegant code that imitates the way we used to do it
    > in our old WebObjects days... we have a saveChanges() method that wraps
    > dc.commitChanges(). Before the commit we can timesstamp the newObjects
    > and modifiedObjects.
    >
    > The trouble is, this sets the timestamp on objects that haven't really
    > been modified... an attribute was set to the same value it already had,
    > or a to-many relationship was added to. Cayenne figures out later in
    > the pipeline that those other changes aren't real and doesn't generate
    > SQL for them. How can I hook into that later point, and set the
    > timestamp only if the row is about to be updated? I looked at
    > DataContextDelegate, but I guess that's for external changes. The event
    > mechanism looks closer, although the docs say that dc.onSync() isn't
    > intended for direct use. Worst case, I could compare the object's
    > current values to the snapshot but that seems reinventing the plumbing.
    >
    > Thanks.
    >
    >



    This archive was generated by hypermail 2.0.0 : Fri Apr 28 2006 - 12:45:20 EDT