This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi, The transaction of method A won't rollback.Bcoz the transaction of method a is suspended when it goes to method B in both the case.But if both the methods are in same Bean then the transaction will be rollbacked and the instance will be killed.
I do not know if anybody is willing to continue this thread but I really do think the question is relevant. In my sense the transaction existing in the method 1 should be "rollbacked" if bean1 is local (even if the transaction has been suspended by the method2's call). If the bean1 is remote it will depend of the catch clause.
The container catches a non-application exception; logs it (which can result in alerting the System Administrator); and, unless the bean is a message-driven bean, throws the java.rmi.RemoteException (or subclass thereof) to the client if the client is a remote client or web service client, or throws the javax.ejb.EJBException (or subclass thereof) to the client if the client is a local client. In the case of a message-driven bean, the container logs the exception and then throws a javax.ejb.EJBException that wraps the original exception to the resource adapter. (See ). The Bean Provider can rely on the container to perform the following tasks when catching a non-application exception: � The transaction in which the bean method participated will be rolled back. � No other method will be invoked on an instance that threw a non-application exception. This means that the Bean Provider does not have to perform any cleanup actions before throwing a non-application exception. It is the container that is responsible for the cleanup.
Hi Adri, I agree with your thinking as I also think that if an EJB throws a system exception container will catch it and throw the RemoteException or EJBException which the client will recieve, now if the client itself is an EJB it will also rethrow as it may not be catching it so this recieving EJB should also be removed by the container as it is throwing a system exception and its transaction should be rolled back.
soni. [ September 21, 2005: Message edited by: Soni Prasad ]