// For pessimistic locking all locks were released by commit.
getPessimisticLockedObjects().clear();
getProperties().remove(LOCK_QUERIES_PROPERTY);
// find next power-of-2 size
IdentityHashtable newCloneMapping = new IdentityHashtable(1 + getCloneMapping().size());
for (Enumeration cloneEnum = getCloneMapping().keys(); cloneEnum.hasMoreElements();) {
Object clone = cloneEnum.nextElement();
// Do not add object that were deleted, what about private parts??
if ((!isObjectDeleted(clone)) && (!getRemovedObjects().containsKey(clone))) {
ClassDescriptor descriptor = getDescriptor(clone);
ObjectBuilder builder = descriptor.getObjectBuilder();
//Build backup clone for DeferredChangeDetectionPolicy or ObjectChangeTrackingPolicy,
//but not for AttributeChangeTrackingPolicy
descriptor.getObjectChangePolicy().revertChanges(clone, descriptor, this, newCloneMapping);
}
}
setCloneMapping(newCloneMapping);
if (hasObjectsDeletedDuringCommit()) {
for (Enumeration removedObjects = getObjectsDeletedDuringCommit().keys();
removedObjects.hasMoreElements();) {
Object removedObject = removedObjects.nextElement();
getIdentityMapAccessor().removeFromIdentityMap((Vector)getObjectsDeletedDuringCommit().get(removedObject), removedObject.getClass());
}
}
// New objects are not new anymore.
// can not set multi clone for NestedUnitOfWork.CR#2015 - XC
if (!isNestedUnitOfWork()) {
//Need to move objects and clones from NewObjectsCloneToOriginal to CloneToOriginals for use in the continued uow
if (hasNewObjects()) {
for (Enumeration newClones = getNewObjectsCloneToOriginal().keys(); newClones.hasMoreElements();) {
Object newClone = newClones.nextElement();
getCloneToOriginals().put(newClone, getNewObjectsCloneToOriginal().get(newClone));
}
}
setNewObjectsCloneToOriginal(null);
setNewObjectsOriginalToClone(null);
}
//reset unitOfWorkChangeSet. Needed for ObjectChangeTrackingPolicy and DeferredChangeDetectionPolicy
setUnitOfWorkChangeSet(null);
// The collections of clones may change in the new UnitOfWork
resetAllCloneCollection();
// 2612538 - the default size of IdentityHashtable (32) is appropriate
setObjectsDeletedDuringCommit(new IdentityHashtable());
setDeletedObjects(new IdentityHashtable());
setRemovedObjects(new IdentityHashtable());
setUnregisteredNewObjects(new IdentityHashtable());
//Reset lifecycle
this.lifecycle = Birth;
this.isSynchronized = false;
}