// Check early return to check if it is a new object, i.e. null primary key.
Boolean doesExist = (Boolean)existQuery.checkEarlyReturn(clone, primaryKey, unitOfWork, null);
if (doesExist == Boolean.FALSE) {
//bug272704: throw an exception if this object is new yet has a version set to avoid merging in deleted objects
if (descriptor.usesVersionLocking()){
VersionLockingPolicy policy = (VersionLockingPolicy)descriptor.getOptimisticLockingPolicy();
Object baseValue = policy.getBaseValue();
Object objectLockValue = policy.getWriteLockValue(clone, primaryKey, unitOfWork);
if ( policy.isNewerVersion(objectLockValue, baseValue) ) {
throw OptimisticLockException.objectChangedSinceLastMerge(clone);