Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Can I use eclipselink to get the differences between two objects?

There is no public API to directly do this.

If you have an object registered in an EclipseLink UnitOfWork (any entity
managed by an EntityManager), you can get the current changes for it made in
the current transaction.  (see UnitOfWork.getCurrentChanges()).

There is an API of Session.compareObjects(), that will return true or false
if two objects match, but not a ChangeSet.

If you wish to go under the covers a little their is an API,
DeferredChangeDetectionPolicy.createObjectChangeSetThroughComparison(), that
will return an ObjectChangeSet listing the changes between the two objects.

Magnus Heino wrote:
> Hi.
> Lets say I have
> Foo foo = new Foo(2);
> Foo foo2 = new Foo(3);
> Foo is an @Entity mapped by eclipselink.
> Can I somehow use components of eclipselink to compare foo and foo2, and
> get
> a list of differences?
> -- 
> /Magnus Heino

--- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top