Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Container and Rollback

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Evil is afoot. But this tiny ad is just an ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic