This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Transaction Query

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The relevant part of the spec is section 18.3.1, pg 377, table 16.


The container will throw RemoteException to a remote client, and EJBException to a local client.


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.
 
Rajnish Bhasin
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks For yr Help Reid.
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both transactions are rolledback due to the RemoteException/EJBException.
A good question and a good explanation!
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic