Page 1 of 1

In CMT If I set Requires_New transactional attribute and throws system exception then client gets which exception?

Posted: Tue Jul 16, 2013 4:05 am
by chintanpatel.it
For example, If I call EJB method from web context. EJB has Container Managed Transaction(CMT) with Local Bean and its method has required_new transactional attribute. What does client gets if EJB method throws System Exception? I mean, transaction is rolled back. So, Does client gets EJBTransactionRolledBackException or simply EJBException?

Thanks in advance.

Re: In CMT If I set Requires_New transactional attribute and throws system exception then client gets which exception?

Posted: Tue Jul 16, 2013 6:38 am
by admin
Since the bean starts a new transaction, the client's transaction will not be rolled back. The client gets EJBException. Check out section 14.3.1 table 15.

Re: In CMT If I set Requires_New transactional attribute and throws system exception then client gets which exception?

Posted: Tue Jul 16, 2013 7:03 am
by chintanpatel.it
Thank you for your answer.

I have one more question. Is there any way to know status of EJB's transaction in above mentioned case?

Re: In CMT If I set Requires_New transactional attribute and throws system exception then client gets which exception?

Posted: Sun Jul 28, 2013 12:51 pm
by kezman9
Yes, you should call getRollbackOnly method on SessionContext object if it's CMT.