object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java
public <RET> RET detach(final Object iPojo, boolean returnNonProxiedInstance) {
    return (RET) OObjectEntitySerializer.detach(iPojo, this, returnNonProxiedInstance);
  }
public <RET> RET detach(final Object iPojo, boolean returnNonProxiedInstance) {
    return (RET) OObjectEntitySerializer.detach(iPojo, this, returnNonProxiedInstance);
  }
Method that detaches all fields contained in the document to the given object.

@param <RET>
@param iPojo                    :- the object to detach
@param returnNonProxiedInstance :- defines if the return object will be a proxied instance or not. If set to TRUE and the
object does not contains @Id and @Version fields it could procude data replication

@return the object serialized or with detached data