Caused by javax.persistence.TransactionRequiredException with message: “no transaction is in progress”
This is weird, I am not sure why I am getting it. I have an application that makes some calculations that take some considerable time, and I persist the results. I run my application with 100 records from the database and everything works fine. I run my application with 60.000 records from the database and I am getting the above error message. The exception happens when the flush() method is called on the EntityManager. If I am to have a wild guess I’d say that there is a transaction time out (it is set to 30 seconds in the weblogic console) and therefore when the flush() method is called there is no active transaction.
Anyway I managed to overcome this issue by explicitly defining a user transaction
import org.jboss.seam.transaction.Transaction; import org.jboss.seam.transaction.UserTransaction; ... ... UserTransaction ut = Transaction.instance(); ut.begin(); ... ... ut.commit();
If you have any idea why this is happening please leave a comment.
UPDATE: Now the first transaction (the one with 100 records) fails. It complains that there is already one transaction active when I try to start a new one. I guess I need to revert my code and to increase the transaction timeout on the weblogic console, this would solve both issues.


Thanks for the tutorial
Try using any third party Connection manager, set the trasaction properties to one which suits your type of application. Best way to handle connections and transactions.
I had some other problems with respect to transaction. I used c3p0 but it didn’t work out later used DBCP and everything is working fine.