/** * Gets the client session. * * @param em the em * @return the client session */ public AbstractSession getClientSession(EntityManager em) { UnitOfWork uow = JpaHelper.getEntityManager(em).getUnitOfWork(); return (AbstractSession) uow; }
/** * Gets the client session. * * @param em the em * @return the client session */ public AbstractSession getClientSession(EntityManager em) { UnitOfWork uow = JpaHelper.getEntityManager(em).getUnitOfWork(); return (AbstractSession) uow; }
/** * @see org.seasar.framework.jpa.Dialect#detach(javax.persistence.EntityManager, java.lang.Object) */ public void detach(EntityManager em, Object managedEntity) { Object delegate = em.getDelegate(); JpaEntityManager eclipselinkEm = JpaEntityManager.class.cast(delegate); UnitOfWork work = eclipselinkEm.getUnitOfWork(); work.unregisterObject(managedEntity); }
Account a = em.merge(account); final JpaEntityManager jpaEntityManager = (JpaEntityManager) em.getDelegate(); final UnitOfWorkChangeSet changeSet = jpaEntityManager.getUnitOfWork().getCurrentChanges(); final ObjectChangeSet accountChangeSet = changeSet.getObjectChangeSetForClone(a); final ObjectChangeSet userChangeSet = changeSet.getObjectChangeSetForClone(a.getUser()); em.clear(); //checks only for these 2 specific fields; changeSet.hasChanges() would check for all changes return accountChangeSet.hasChangeFor("credits") || userChangeSet.hasChangeFor("name");
log.trace("Applying query timeout {} sec", timeoutSec); if (entityManager instanceof JpaEntityManager) { UnitOfWork unitOfWork = ((JpaEntityManager) entityManager).getUnitOfWork(); if (unitOfWork != null) {
/** * Returns the current Compass session associated with the {@link javax.persistence.EntityManager}. * Compass Session is associated with an Entity Manager when a transaction is started and removed when the * transaction commits/rollsback. * * <p>The session can be used to perform searches that needs to take into account current transactional changes * or to perform additional Compass operations that are not reflected by the mirroring feature. */ public static CompassSession getCurrentCompassSession(EntityManager em) { JpaEntityManager nativeEm = (JpaEntityManager) NativeJpaHelper.extractNativeJpa(em); return findCompassSessionEventListener(nativeEm.getServerSession()).getCurrentCompassSession(nativeEm.getUnitOfWork()); }