persistence@glassfish.java.net

How to commit a JTA Transaction

From: ali aslan <aliforummails_at_googlemail.com>
Date: Fri, 23 Jun 2006 09:19:23 +0200

Hi,

I have configured my Toplink to run with own JTA Transaction,DataSource
ServerPlatform...


I am trying to persist a Object. I am not getting an error but the object is
not in the Database. I think I am Committing my
UserTransaction(XAConnection) but this will not commit my JTA Transaction.

        EntityManager em = getEntityManager();

        UserTransactionImpl.begin();

        em.joinTransaction();

        em.persist(pNumber);

        userTransactionImpl.commit();

        em.close();

Anyone who knows how to commit the JTA Transaction.


        em.getTransaction().commit() does not work because

        em.getTransaction() returns a EntityTransaction which does not work
with a JTA
        Transcation.



Thanks