Re: Any way to check if object has really changed?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Mar 24 2009 - 09:47:32 EDT

  • Next message: Michael Gentry: "Re: Any way to check if object has really changed?"

    I think Andrey wants to do the opposite (??) - detect "phantom"
    changes that transfer an object to the MODIFIED state, but do not
    result in a DB record update.

    Andrus

    On Mar 24, 2009, at 3:36 PM, Michael Gentry wrote:

    > Well, the Artist object didn't really change. Could you override
    > Artist's addToPaintings() (don't forget to call super) and record
    > somewhere that a change has been made?
    >
    > mrg
    >
    >
    > On Tue, Mar 24, 2009 at 6:16 AM, Andrey Razumovsky
    > <razumovsky.andre..mail.com> wrote:
    >> Imagine you have Artist and Painting entities. You create a new
    >> Paining and
    >> attach it to existing Artist, then commit. The Artist object is
    >> marked as
    >> modified, so LifecycleListeners will fire for it, but in fact nothing
    >> changed in DB table (ARTIST). Is there any way to check if object
    >> has really
    >> changed? I suppose I could iterate through all attrs and simple to-
    >> one rels
    >> during lifecycle event, and compare values with cached snapshot of
    >> the CDO,
    >> but this seems to be an ugly way..
    >>
    >> Thanks,
    >> Andrey
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Mar 24 2009 - 09:48:08 EDT