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
1
2
3
4
5
6
7
8
9
10
| 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.
No comments:
Post a Comment