Examples of joinTransaction()


Examples of javax.persistence.EntityManager.joinTransaction()

                candidate.getIncomingInvitations().remove(inv);
            }

            //inv.setCandidate(null);
            //inv.setRequestor(null);
            em.joinTransaction();

            Invitation inv0 = em.merge(inv);
            //merge the two people
            em.merge(requestor);
            em.merge(candidate);
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

        EntityManager em = emf.createEntityManager();

        UserTransaction utx = getUtx();
        try {
            utx.begin();
            em.joinTransaction();
            out = call.call(em);
            utx.commit();
        } catch (Exception e) {
            utx.rollback();
        } finally {
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

        final Object values = expression.evaluate(exchange, Object.class);
        if (values != null) {
            transactionTemplate.execute(new TransactionCallback<Object>() {
                public Object doInTransaction(TransactionStatus status) {
                    if (getEndpoint().isJoinTransaction()) {
                        targetEntityManager.joinTransaction();
                    }
                    if (values.getClass().isArray()) {
                        Object[] array = (Object[])values;
                        for (int index = 0; index < array.length; index++) {
                            save(array[index]);
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

                    }

                    if (getEndpoint().isFlushOnSend()) {
                        // there may be concurrency so need to join tx before flush
                        if (getEndpoint().isJoinTransaction()) {
                            targetEntityManager.joinTransaction();
                        }
                        targetEntityManager.flush();
                    }

                    return null;
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

                 * save the given entity end return the managed entity
                 * @return the managed entity
                 */
                private Object save(final Object entity) {
                    // there may be concurrency so need to join tx before persist/merge
                    targetEntityManager.joinTransaction();
                    if (getEndpoint().isUsePersist()) {
                        targetEntityManager.persist(entity);
                        return entity;
                    } else {
                        return targetEntityManager.merge(entity);
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

   
    //Use a JTA tran to show integration
    UserTransaction ut = context().getService(UserTransaction.class);
   
    ut.begin();
    em.joinTransaction();
    Car c = new Car();
    c.setNumberPlate("123456");
    c.setColour("blue");
    em.persist(c);
   
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

            } else {
                internalCmdScopedEntityManagerFlag = false;
            }
        }
        cmdScopedEntityManager.joinTransaction();
        if (this.appScopedEntityManager != null) {
            this.appScopedEntityManager.joinTransaction();
        }
        return cmdScopedEntityManager;
    }
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

      
        // Initialized persistence/tx's and persist to db
        EntityManager em = emf.createEntityManager();
        UserTransaction tx = findUserTransaction();
        tx.begin();
        em.joinTransaction();
        em.persist(badMainObject);
       
        boolean rollBackExceptionthrown = false;
        try {
            logger.info("The following " + IllegalStateException.class.getSimpleName() + " SHOULD be thrown.");
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

        mainObject.setName("main" + testName);
        mainObject.setSubObject(subObject);
       
        // Now persist both..
        tx.begin();
        em.joinTransaction();
        em.persist(mainObject);
        em.persist(subObject);
       
        try {
            tx.commit();
View Full Code Here

Examples of javax.persistence.EntityManager.joinTransaction()

            internalCmdScopedEntityManager.setFlushMode(FlushModeType.COMMIT);

            cmdScopedEntityManager = internalCmdScopedEntityManager;
        }
       
        cmdScopedEntityManager.joinTransaction();
        appScopedEntityManager.joinTransaction();
    }

    public void endCommandScopedEntityManager() {
        EntityManager cmdScopedEntityManager = getInternalCommandScopedEntityManager();
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.