Package javax.persistence

Examples of javax.persistence.EntityManager.joinTransaction()


    EntityManagerFactory emf = cefb.getObject();
    assertSame("EntityManagerFactory reference must be cached after init", emf, cefb.getObject());

    assertNotSame("EMF must be proxied", mockEmf, emf);
    EntityManager em = emf.createEntityManager();
    em.joinTransaction();
    assertFalse(em.contains(testEntity));

    jpatm.commit(txStatus);

    cefb.destroy();
View Full Code Here


    protected EntityManager begin() {
        try {
            lock.lock();
            EntityManager em = getEntityManager();
            if (isManaged) {
                em.joinTransaction();
            } else {
                if (!em.getTransaction().isActive()) {
                    em.getTransaction().begin();
                }
            }
View Full Code Here

    protected EntityManager begin() {
        try {
            lock.lock();
            EntityManager em = getEntityManager();
            if (isManaged) {
                em.joinTransaction();
            } else {
                if (!em.getTransaction().isActive()) {
                    em.getTransaction().begin();
                }
            }
View Full Code Here

    public void initData() throws Exception {
        SimpleJtaTransactionManagerImpl.getInstance().begin();

        newEntityManager();
        EntityManager em = getEntityManager();
        em.joinTransaction();
        IntTestEntity ite = new IntTestEntity(10);
        em.persist(ite);
        id1 = ite.getId();

        SimpleJtaTransactionManagerImpl.getInstance().commit();
View Full Code Here

    this.sharedEntityManager.createQuery("SELECT RUBBISH FROM RUBBISH HEAP").executeUpdate();
  }

  public void testApplicationManaged() {
    EntityManager appManaged = this.entityManagerFactory.createEntityManager();
    appManaged.joinTransaction();
  }

  public void testGetVets() {
    Collection<Vet> vets = this.clinic.getVets();
    // Use the inherited countRowsInTable() convenience method (from
View Full Code Here

      final EntityManager em = (EntityManager) session.getScope().remove(PERSISTENCE_CONTEXT_ATTRIBUTE);
      Boolean commitStatus = session.getState().getAttributes().getBoolean("commit");
      if (Boolean.TRUE.equals(commitStatus)) {
        transactionTemplate.execute(new TransactionCallbackWithoutResult() {
          protected void doInTransactionWithoutResult(TransactionStatus status) {
            em.joinTransaction();
          }
        });
      }
      unbind(em);
      em.close();
View Full Code Here

                .getConfiguration().getManagedRuntimeInstance();

        runtime.getTransactionManager().begin();
        try {
            final EntityManager em = emf.createEntityManager();
            em.joinTransaction();

            final X x = new X();
            em.persist(x);
            runtime.getTransactionManager().commit();
        }
View Full Code Here

    protected EntityManager begin() {
        try {
            lock.lock();
            EntityManager em = getEntityManager();
            if (isManaged) {
                em.joinTransaction();
            } else {
                if (!em.getTransaction().isActive()) {
                    em.getTransaction().begin();
                }
            }
View Full Code Here

        return "post-remove";
    }
   
    public void testPostRemoveInvokedOnlyAfterDatabaseDeleteWithLogicalFlush() {
        EntityManager em = emf.createEntityManager();
        em.joinTransaction();
        PostRemoveCallbackEntity pc = new PostRemoveCallbackEntity();
        em.persist(pc);
        em.flush();
        em.remove(pc);
        commit();
View Full Code Here

        em.close();
    }
   
    public void testPostRemoveInvokedAfterDatabaseDeleteWithoutFlush() {
        EntityManager em = emf.createEntityManager();
        em.joinTransaction();
        PostRemoveCallbackEntity pc = new PostRemoveCallbackEntity();
        em.persist(pc);
        em.remove(pc);
        assertFalse("PostRemove called before commit", isPostRemovedInvoked(pc));
        commit();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.