help required specifying Transation attributes for this scenario
843830Jul 2 2005 — edited Jul 4 2005Hi ,
I am trying to create/update rows in a database using BMP and CMP beans.
A business method ( Method1 )in session bean calls a non-business method ( Method2) in the same session bean which inturn calls an EntityBean ( EB1-BMP) . EB1 can throw a certain business exception upon which , the Method1 in the session bean calls another EntityBean in a loop( EB2-CMP).
The problem is that , when the EB1 throws the business exception, i am getting an exception ( part of the stack trace attached below ).
Could any please explain what should be the transaction attributes to be specified for this scenario.
Using RequiresNew for the EntityBeans would not work ( or would it ?? ) because the entity bean is being called in a loop and the commit or rollback should happen for all the methods.
I feel the problem should be solved by specifying the transaction attribute for Method2 ( non business method in session bean ) as Required, but i guess this is not possible.
How exactly will the transaction behave in this scenario, is the exception caused because EB1 has thrown an exception and i am trying to continue the transaction.
Could someone please suggest a solution or workaround for this problem.
Regards,
Harsha
---- Begin backtrace for nested exception
java.lang.IllegalStateException
at com.ibm.ws.Transaction.JTA.TransactionImpl.enlistResource(TransactionImpl.java:1694)
.
.
.
javax.ejb.EJBException: nested exception is: com.ibm.ws.ejbpersistence.utilpm.PersistenceManagerException: PMGR6022E: Error using adapter to create or execute an Interaction. com.ibm.ws.rsadapter.cci.WSInteractionImpl@28d16547
.
.
.