use of org.eclipse.persistence.internal.sessions.DirectCollectionChangeRecord in project eclipselink by eclipse-ee4j.
the class DirectCollectionMapping method updateChangeRecord.
/**
* INTERNAL:
* Either create a new change record or update with the new value. This is used
* by attribute change tracking.
* Specifically in a collection mapping this will be called when the customer
* Set a new collection. In this case we will need to mark the change record
* with the new and the old versions of the collection.
* And mark the ObjectChangeSet with the attribute name then when the changes are calculated
* force a compare on the collections to determine changes.
*/
@Override
public void updateChangeRecord(Object clone, Object newValue, Object oldValue, ObjectChangeSet objectChangeSet, UnitOfWorkImpl uow) {
DirectCollectionChangeRecord collectionChangeRecord = (DirectCollectionChangeRecord) objectChangeSet.getChangesForAttributeNamed(this.getAttributeName());
if (collectionChangeRecord == null) {
collectionChangeRecord = new DirectCollectionChangeRecord(objectChangeSet);
collectionChangeRecord.setAttribute(getAttributeName());
collectionChangeRecord.setMapping(this);
objectChangeSet.addChange(collectionChangeRecord);
}
collectionChangeRecord.setIsDeferred(true);
objectChangeSet.deferredDetectionRequiredOn(getAttributeName());
if (collectionChangeRecord.getOriginalCollection() == null) {
collectionChangeRecord.recreateOriginalCollection(oldValue, uow);
}
collectionChangeRecord.setLatestCollection(newValue);
}
Aggregations