[jboss-user] [EJB 3.0] - Transaction annotation - cannot get desired behavior
do-not-reply at jboss.com
Wed Apr 18 14:32:51 EDT 2007
JBoss 4.0.5 (em = injected entitymanger in text below)
Need a way to prevent an EntityExistsException from stopping processing (kills DB connection).
In a loop callimg em.persist(obj);
After an EntityExistsException is thrown I get the following trying to continue in the same method.
20:35:40,265 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: null
20:35:40,265 ERROR [JDBCExceptionReporter] Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=w2ksvr/10, BranchQual=, localId=10]; - nested throwable: (javax.resource.ResourceException: Transaction is not active: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=w2ksvr/10, BranchQual=, localId=10])
After some reading I found the transaction is marked for rollback due to the exception.
So I moved the persist call into a method that has
This does not seem to have any affect. In fact the inserts that are being done in each call to the method (with no exception) are not committed to the DB until to top method in the call stack exits. I though that the REQUIRES_NEW annotation should force the commit of the transaction at the end of the method that it applies to???????
My server call stack is:
session bean-1 calls
session bean-2 method that does DB work
It appears the commit does not occur until the session bean-1 method exits. Ideas? Have I understood how the annotation is supposed to work?
em calls from either bean report 'Cannot open connection' on subsequent em calls
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4038581#4038581
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4038581
More information about the jboss-user