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 » Tue Jul 16, 2013 4:05 am

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.

admin
Site Admin
Posts: 8621
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 » Tue Jul 16, 2013 6:38 am

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.
If you like our products and services, please help us by posting your review here.

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 » Tue Jul 16, 2013 7:03 am

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
Location: Poland
Contact:

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

Post by kezman9 » Sun Jul 28, 2013 12:51 pm

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 0 guests