public Collection detach(Collection entities) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Collection copies = uow.registerAllObjects(entities); uow.release(); return copies; }
public Collection detach(Collection entities) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Collection copies = uow.registerAllObjects(entities); uow.release(); return copies; }
public Collection detach(Collection entities) { UnitOfWork uow = ((org.eclipse.persistence.internal.sessions.AbstractSession)getSharedSession()).acquireNonSynchronizedUnitOfWork(null); Collection copies = uow.registerAllObjects(entities); uow.release(); return copies; }
@Override public void preBeginTransaction(SessionEvent event) { try { UnitOfWork work = event.getSession().acquireUnitOfWork(); try { work.executeNonSelectingSQL("set names utf8mb4"); work.commit(); work = null; } finally { if (work != null) work.release(); } } catch (Exception ex) { log.error("UTF8MB4", ex); } } });
/** * 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; }
((UnitOfWork) session).release();