TransactionRequiredException: No transaction is currently active
594335Aug 27 2007 — edited Aug 31 2007I'm using IBM's RAD 7.0 with TopLink Essentials - 2.0 (Build b41-beta2), so I'm running in a Java SE 1.5/Java EE 1.4 environment. The application is executing in IBM's WAS 6.1.
I try to do an insert into the database when I get a TransactionRequiredException (No transaction is currently active). The code looks like this:
getEntityManager().joinTransaction();
MessageBatch mb = new MessageBatch();
//Setting the object's values
...
getEntityManager().persist(mb);
If I remove the call to joinTransaction and instead call flush after the call to persist the same exception is thrown. Before calling the method containing this code I've started a transaction using the begin method on a javax.transaction.UserTransaction object.
Anyone know why the exception is thrown? Do I have to specify the transaction type in the persistence.xml file?