1

Previously I was using seam 2.1 and JPA 1 along with JBOSS 5. In this configuration I was accessing user transaction using below code:

 UserTransaction userTx = Transaction.instance();
            if (userTx != null) {
                boolean previousTransaction = Transaction.instance().isActive();
                if (!previousTransaction) {
                    Transaction.instance().begin();
                }

                userTx.setTransactionTimeout(10 * 60);
                entityManager().joinTransaction();
                entityManager().persist(pur);
                entityManager().flush();
                userTx.commit();

                if (previousTransaction) {
                    userTx.begin();
                }
            }
        }

After that I have migrated to seam 2.3 and jpa 2 along with wildfly 8.2.0. I can not access the user transaction with above code so can anyone please guide me on how to access the user transaction in wildfly 8.2.0.?

What I am primarily looking for is the way to immediately perist my changes when I do flush using entitymanagaer and it should not wait for method to exit.

Please guide me on this.

TT.
  • 15,774
  • 6
  • 47
  • 88

1 Answers1

0

You can get the UserTransaction using the below code.

UserTransaction ut = EJBClient.getUserTransaction("node1");

In the above code node1 is the VM argument which you have to set to your WildFly. Please add the below VM arguments.

-Djboss.node.name=node1

This should solve your issue.

Sreenath Reddy
  • 390
  • 8
  • 29