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

Moderator: admin

Post Reply
chintanpatel.it
Posts: 2
Joined: Tue Jul 16, 2013 4:04 am
Contact:

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

Post 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.

Online
admin
Site Admin
Posts: 10385
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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.

chintanpatel.it
Posts: 2
Joined: Tue Jul 16, 2013 4:04 am
Contact:

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

Post 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?

kezman9
Posts: 26
Joined: Fri Jul 06, 2012 1:08 am
Contact:

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

Post by kezman9 »

Yes, you should call getRollbackOnly method on SessionContext object if it's CMT.

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests