Re: Track changes of a dataobjects property

From: Cris Daniluk (cris.danilu..mail.com)
Date: Thu Apr 21 2005 - 20:51:50 EDT

  • Next message: Fredrik Liden: "RE: Track changes of a dataobjects property"

    You can access the snapshot and compare directly... not sure if that
    works for you or not. getCommittedSnapshot() and getCurrentSnapshot()
    can give you the differences.

    There's also the un-documented but very present FieldValueChangeEvent
    that you could use. Just register it in the DataView, and then use it
    to collect the modifications for later review. It's a funky way to get
    to what you want, but if you need more realtime access to property
    changes, it's an elegant way to do it.

    A slightly more intuitive but less cool way to do it is to just change
    the superclass you use from CayenneDataObject to your own, and wrap
    writeProperty.

    Still, from the sounds of what you're doing, the snapshot should be
    all you need...

    On 4/21/05, Fredrik Liden <flide..ranslate.com> wrote:
    > Does anyone know if it's possible to track changes of the individual
    > properties of a data object?
    > I know there is the get persistence state but it's for the whole object.
    > I'm trying to do some custom validations in a validateForUpdate method
    > and allow only certain fields to be modified.
    > Just wondering.
    >
    > Thanks,
    >
    > Fredrik
    >



    This archive was generated by hypermail 2.0.0 : Thu Apr 21 2005 - 20:51:51 EDT