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

Container and Rollback

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy,

Please comment on the truth ness of the following comments...

1. Container is not responsible for committing or rolling back transactions that have been initiated by the client.
2. The container is only responsible for rolling back a system exception for an message-driven bean with container-managed transaction demarcation and when the bean method runs in the context of a transaction started by the container. A transaction is not rolled backed by the container as a result of a system exception thrown when the transaction runs with an unspecified transaction context and also when a bean is declared with bean-managed transaction demarcation.

And what should be the correct answer for the following question...
Question:
What will the container do when a bean managed message driven bean throws a system exception? [Check all correct answers]
1. Log the system exception.
2. Mark the transaction for rollback.
3. The container will discard the message driven bean instance and will not invoke any business methods or container callbacks on the instance.
4. The container will commit the transaction unless the deployment descriptor specifies otherwise.
5. The client will receive a RemoteException.

As per the given answer... option 1, 2, and 3. I am confused as MDB is a BMT bean so option 2 should not be true.

Thanks
-Rahul

:roll:
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Option 2 is correct. Remember, a transaction is scoped at method level. So, if a system exception is thrown, the container must ensure that the transaction is ended. (We are assuming that the exception is not handled.) This is done by marking for rollback a transaction that has been started, but not yet completed, by the instance.
 
We've gotta get close enough to that helmet to pull the choke on it's engine and flood his mind! Or, we could just read this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic