Hi Everyone, We are aware of the fact that- If a bean with CMT calls a method on a Bean with BMT, the transation would suspend becoz a BMT would not entertain any other transaction other than itself. Lets say that the BMT method so called also has its own transaction....and that BMT method throws a SYSTEM Exception. Now although the SPEC says that the Outer Transaction Started by the CMT has nothing to do with the one started by the BMT. But the point is that System Exceptions ask for Beans to be removed from the POOL and the Transaction to be rolled back. Can anyone please tell me what will happen to the Transaction that was started by the CMT bean. Thanks In Advance...
Best Regards,<br />Rajnish Bhasin.<br />SCJP<br />SCWCD<br />SCBCD
Reid M. Pinchback
Joined: Jan 25, 2002
The relevant part of the spec is section 18.3.1, pg 377, table 16.
So, let's call the CMT bean "beanC" and the BMT bean "beanB". beanC is calling beanB. When beanB throws a system exception, the container will throw either RemoteException or EJBException to beanC, depending on whether beanC is remote or local respectively. If beanC is a remote client, it has no choice but to catch RemoteException because RemoteException is not a RuntimeException. Unless beanC chooses to mark its own transaction for rollback or throw a system exception of its own, beanC's transaction survives. If beanC is a local client, it isn't forced to catch the EJBException because EJBException is a RuntimeException. Whether beanC's transaction will survive will depend on whether or not the beanC method allows a system exception (the one from beanB or something thrown within beanC) to be thrown to the container.
Reid - SCJP2 (April 2002)
Joined: Mar 01, 2004
Thanks For yr Help Reid.
Joined: Aug 27, 2003
Both transactions are rolledback due to the RemoteException/EJBException. A good question and a good explanation!