/** * Build a detached copy using a one-off UnitOfWork. * This simulates creation of a copy through serialization when using a * remote session bean if this copy process is not done the user of this * helper would return the shared copy from the cache that should not be * modified. These detachment methods *MUST* be used for local session * beans where the returned objects can be modified by the client. * * @param entity an existing persistent entity * @return a copy of the entity for use in a local client that may make changes to it */ public Object detach(Object entity) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Object copy = uow.registerObject(entity); uow.release(); return copy; }
/** * Build a detached copy using a one-off UnitOfWork. * This simulates creation of a copy through serialization when using a * remote session bean if this copy process is not done the user of this * helper would return the shared copy from the cache that should not be * modified. These detachment methods *MUST* be used for local session * beans where the returned objects can be modified by the client. * * @param entity an existing persistent entity * @return a copy of the entity for use in a local client that may make changes to it */ public Object detach(Object entity) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Object copy = uow.registerObject(entity); uow.release(); return copy; }
/** * Build a detached copy using a one-off UnitOfWork. * This simulates creation of a copy through serialization when using a * remote session bean if this copy process is not done the user of this * helper would return the shared copy from the cache that should not be * modified. These detachment methods *MUST* be used for local session * beans where the returned objects can be modified by the client. * * @param entity an existing persistent entity * @return a copy of the entity for use in a local client that may make changes to it */ public Object detach(Object entity) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Object copy = uow.registerObject(entity); uow.release(); return copy; }