if (!(attributeValue instanceof Proxy)) {
boolean isExisting = unitOfWork.isObjectRegistered(clone) && (!unitOfWork.isOriginalNewObject(original));
return this.getMapping().buildCloneForPartObject(attributeValue, original, clone, unitOfWork, isExisting);
}
ValueHolderInterface newValueHolder;
ProxyIndirectionHandler handler = (ProxyIndirectionHandler)Proxy.getInvocationHandler(attributeValue);
ValueHolderInterface oldValueHolder = handler.getValueHolder();
if (!buildDirectlyFromRow && unitOfWork.isOriginalNewObject(original)) {
// CR#3156435 Throw a meaningful exception if a serialized/dead value holder is detected.
// This can occur if an existing serialized object is attempt to be registered as new.
if ((oldValueHolder instanceof DatabaseValueHolder)
&& (! ((DatabaseValueHolder) oldValueHolder).isInstantiated())
&& (((DatabaseValueHolder) oldValueHolder).getSession() == null)
&& (! ((DatabaseValueHolder) oldValueHolder).isSerializedRemoteUnitOfWorkValueHolder())) {
throw DescriptorException.attemptToRegisterDeadIndirection(original, getMapping());
}
newValueHolder = new ValueHolder();
newValueHolder.setValue(this.getMapping().buildCloneForPartObject(oldValueHolder.getValue(), original, clone, unitOfWork, false));
} else {
AbstractRecord row = null;
if (oldValueHolder instanceof DatabaseValueHolder) {
row = ((DatabaseValueHolder)oldValueHolder).getRow();
}