Reputation: 23
What happens if a system exception occurs from a method in a session bean that has a transaction attribute REQUIRED_NEW and this method is called by some other method which is running in other transaction (i.e REQUIRED).
Will the suspended transcation(i.e Required) rollback or not ??
Upvotes: 0
Views: 217
Reputation: 2981
what happens if System Exception occurs from a method in a session bean in EJB 3.0?
This is what the ejb3 specification says:
14.2.2 System Exceptions
... The container catches a non-application exception; logs it; and, unless the bean is a message-driven bean, throws the javax.ejb.EJBException.
... The transaction in which the bean method participated will be rolled back....
and the bean instance will be discared.
Will the suspended transcation(i.e Required) rollback or not ??
In your case the Client method runs in a different transactional context, therefore, if you catch the
javax.ejb.EJBException
that was originated in the target bean, the transaction will commit. Otherwise, the transaction will be rolled back.
Upvotes: 1
Reputation: 515
If you don't handle exception inside method A, exception will throw higher and rollback bought transactions.
Upvotes: 0