Is it possible to make it consider @OneToMany mappings also?
It will report a difference no matter what I put into the @OneToMany set, even if the objects themself are equal if passed into the createObjectChangeSetThroughComparison method.
I would like to work with a object graph rather than with individual objects.
Under the covers api's are not a problem.
I currently do it like this:
@Autowired
private JpaEntityManager entityManager;
private final ObjectChangePolicy objectChangePolicy = new DeferredChangeDetectionPolicy();
public ObjectChangeSet compare(final AbstractEntity original, final AbstractEntity copy) {
ObjectChangeSet objectChangeSet = this.objectChangePolicy.createObjectChangeSetThroughComparison(original, copy,
(UnitOfWorkChangeSet) this.entityManager.getUnitOfWork().getCurrentChanges(), false, (AbstractSession) this.entityManager
.getActiveSession(), this.entityManager.getActiveSession().getDescriptor(original.getClass()));
return objectChangeSet;
}
Thanks!
/Magnus