You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Lon Varscsak <lo...@gmail.com> on 2015/08/25 23:07:37 UTC

Committed values of an object

Is there a way to get the committed value of a property?  There have been a
few times with EOF where comparing the current value with the committed
snapshot is handy.

-Lon

Re: Committed values of an object

Posted by Lon Varscsak <lo...@gmail.com>.
These ideas worked great.  Thanks guys!

-Lon

On Tue, Aug 25, 2015 at 2:44 PM, Michael Gentry <mg...@masslight.net>
wrote:

> Hi Lon,
>
> You can use/modify isIdenticalToSnapshot() here:
>
> https://gist.github.com/mrg/4dce22b67175c27f4047
>
> At least that worked for Cayenne 3.0.2 -- you didn't specify which version
> of Cayenne.  I suspect this will work for more recent versions as well.
>
> mrg
>
>
> On Tue, Aug 25, 2015 at 5:07 PM, Lon Varscsak <lo...@gmail.com>
> wrote:
>
> > Is there a way to get the committed value of a property?  There have
> been a
> > few times with EOF where comparing the current value with the committed
> > snapshot is handy.
> >
> > -Lon
> >
>

Re: Committed values of an object

Posted by Michael Gentry <mg...@masslight.net>.
Hi Lon,

You can use/modify isIdenticalToSnapshot() here:

https://gist.github.com/mrg/4dce22b67175c27f4047

At least that worked for Cayenne 3.0.2 -- you didn't specify which version
of Cayenne.  I suspect this will work for more recent versions as well.

mrg


On Tue, Aug 25, 2015 at 5:07 PM, Lon Varscsak <lo...@gmail.com>
wrote:

> Is there a way to get the committed value of a property?  There have been a
> few times with EOF where comparing the current value with the committed
> snapshot is handy.
>
> -Lon
>

Re: Committed values of an object

Posted by Hugi Thordarson <hu...@karlmenn.is>.
DataContext dataContext = (DataContext)object.getObjectContext();
ObjectStore objectStore = dataContext.getObjectStore();
DataRow snapshot = objectStore.getSnapshot( object.getObjectId() );

Note that the keys in the returned snapshot correspond to your DbEntity rather than your ObjEntity.

Cheers,
- hugi



> On 25. ágú. 2015, at 21:07, Lon Varscsak <lo...@gmail.com> wrote:
> 
> Is there a way to get the committed value of a property?  There have been a
> few times with EOF where comparing the current value with the committed
> snapshot is handy.
> 
> -Lon