object/src/main/java/com/orientechnologies/orient/object/db/OObjectDatabaseTx.java
public <RET> RET detachAll(final Object iPojo, boolean returnNonProxiedInstance) {
    return detachAll(iPojo, returnNonProxiedInstance, new HashMap<Object, Object>(), new HashMap<Object, Object>());
  }
public <RET> RET detachAll(final Object iPojo, boolean returnNonProxiedInstance) {
    return detachAll(iPojo, returnNonProxiedInstance, new HashMap<Object, Object>(), new HashMap<Object, Object>());
  }
Method that detaches all fields contained in the document to the given object and recursively all object tree. This may throw a
{@link StackOverflowError} with big objects tree. To avoid it set the stack size with -Xss java option

@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