You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Dave Lamy <da...@gmail.com> on 2009/09/17 21:04:38 UTC

Determining modified attribute values

Forgive me if this has already been hashed out, but my google-foo isn't
working well today.

I have a case where, upon saving a persistent object with a modified
attribute value, I need to perform a file migration.  The trick is that I
need to know both the previous and new values of the attribute in question.

I presume that Cayenne is tracking these old/new values in the GraphManager
in order to determine which columns to update.  So, what is the best way for
me to access this changeset?

Thanks for the help--
Dave

Re: Determining modified attribute values

Posted by Dave Lamy <da...@gmail.com>.
Thanks for the reply on this Andrey-- sorry for the delay in expressing my
gratitude :-).

I've gotten pulled away from this little nugget for the time being, but will
be sure to update when I have a chance to give it a go.

Dave

On Thu, Sep 17, 2009 at 2:26 PM, Andrey Razumovsky <
razumovsky.andrey@gmail.com> wrote:

> Alternatively, you can save untouched value in local variable on postLoad
> and other post-callbacks
>
> 2009/9/17 Andrey Razumovsky <ra...@gmail.com>
>
> > Hi Dave,
> >
> > As far as I remember, GraphDiff API is currently closed. If you need to
> > oversee changes during preUpdate(), try to get old values from cached
> > snapshot:
> > DataRow snapshot =
> > context.getObjectStore().getCachedSnapshot(cdo.getObjectId());
> > String oldValue = (String) snapshot.get("FILENAME");
> >
> > 2009/9/17 Dave Lamy <da...@gmail.com>
> >
> > Forgive me if this has already been hashed out, but my google-foo isn't
> >> working well today.
> >>
> >> I have a case where, upon saving a persistent object with a modified
> >> attribute value, I need to perform a file migration.  The trick is that
> I
> >> need to know both the previous and new values of the attribute in
> >> question.
> >>
> >> I presume that Cayenne is tracking these old/new values in the
> >> GraphManager
> >> in order to determine which columns to update.  So, what is the best way
> >> for
> >> me to access this changeset?
> >>
> >> Thanks for the help--
> >> Dave
> >>
> >
> >
> >
> > --
> > Andrey
> >
>
>
>
> --
> Andrey
>

Re: Determining modified attribute values

Posted by Andrey Razumovsky <ra...@gmail.com>.
Alternatively, you can save untouched value in local variable on postLoad
and other post-callbacks

2009/9/17 Andrey Razumovsky <ra...@gmail.com>

> Hi Dave,
>
> As far as I remember, GraphDiff API is currently closed. If you need to
> oversee changes during preUpdate(), try to get old values from cached
> snapshot:
> DataRow snapshot =
> context.getObjectStore().getCachedSnapshot(cdo.getObjectId());
> String oldValue = (String) snapshot.get("FILENAME");
>
> 2009/9/17 Dave Lamy <da...@gmail.com>
>
> Forgive me if this has already been hashed out, but my google-foo isn't
>> working well today.
>>
>> I have a case where, upon saving a persistent object with a modified
>> attribute value, I need to perform a file migration.  The trick is that I
>> need to know both the previous and new values of the attribute in
>> question.
>>
>> I presume that Cayenne is tracking these old/new values in the
>> GraphManager
>> in order to determine which columns to update.  So, what is the best way
>> for
>> me to access this changeset?
>>
>> Thanks for the help--
>> Dave
>>
>
>
>
> --
> Andrey
>



-- 
Andrey

Re: Determining modified attribute values

Posted by Andrey Razumovsky <ra...@gmail.com>.
Hi Dave,

As far as I remember, GraphDiff API is currently closed. If you need to
oversee changes during preUpdate(), try to get old values from cached
snapshot:
DataRow snapshot =
context.getObjectStore().getCachedSnapshot(cdo.getObjectId());
String oldValue = (String) snapshot.get("FILENAME");

2009/9/17 Dave Lamy <da...@gmail.com>

> Forgive me if this has already been hashed out, but my google-foo isn't
> working well today.
>
> I have a case where, upon saving a persistent object with a modified
> attribute value, I need to perform a file migration.  The trick is that I
> need to know both the previous and new values of the attribute in question.
>
> I presume that Cayenne is tracking these old/new values in the GraphManager
> in order to determine which columns to update.  So, what is the best way
> for
> me to access this changeset?
>
> Thanks for the help--
> Dave
>



-- 
Andrey