Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Fetch original state of the object

Attribute change tracking does not keep the original state, only the list of
attributes that change.  When using weaving attribute change tracking is the
default, otherwise it is deferred.

If you use deferred change tracking, then you can get the backupClone from
the UnitOfWork, it will have the original values.

I think there is an enhancement request for have the ObjectChangeSets
contain the old values, feel free to vote for this, or add one if you can't
find it.  You may also be able to create your own
AttributeChangeTrackingPolicy subclass that keeps the old values.


Gaurav Malhotra wrote:
> 
> Hi,
> 
>   I want to write attribute change validation rules. I gathered that
> eclipse link automatically weave change tracker into the jpa entities + it
> uses AttributeChangeTrackingPolicy (by default), hence keep the clone of
> the original object.
> Pre - condition :- Weaving should be enabled.
>    (Please validate my understanding)
> 
>   How can I get the original state of the object. By original state I mean
> state of object before the update chnages were applied.
> 
>   AttributeChangeListner acl = (  AttributeChangeListner)
> (((ChanageTracker) xxxx)._persistence_getPropertyChangeListener())
> 
>   Now how to get the original state of the object???
> 
> Regards,
> Gaurav Malhotra
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/Fetch-original-state-of-the-object-tp24488730p24518189.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top