/** * Return the coresponding value that should be assigned to the target object for the source object. * This value must be local to the targets object space. */ public Object getTargetVersionOfSourceObject(Object source) { if (shouldMergeWorkingCopyIntoOriginal() || shouldMergeWorkingCopyIntoRemote()) { // Target is in uow parent, or original instance for new object. return ((UnitOfWorkImpl)getSession()).getOriginalVersionOfObject(source); } else if (shouldMergeCloneIntoWorkingCopy() || shouldMergeOriginalIntoWorkingCopy() || shouldMergeCloneWithReferencesIntoWorkingCopy()) { // Target is clone from uow. //make sure we use the register for merge //bug 3584343 return registerObjectForMergeCloneIntoWorkingCopy(source); } else if (shouldRefreshRemoteObject()) { // Target is in session's cache. ClassDescriptor descriptor = getSession().getDescriptor(source); Vector primaryKey = descriptor.getObjectBuilder().extractPrimaryKeyFromObject(source, getSession()); return getSession().getIdentityMapAccessorInstance().getFromIdentityMap(primaryKey, source.getClass(), descriptor); } throw ValidationException.invalidMergePolicy(); }
Object registeredObject = registerObjectForMergeCloneIntoWorkingCopy(rmiClone);