• 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

EJBException dooms transaction?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am seeing a mock test question that asks if to throw a EJBException from a CMT bean will roll back the current transaction if any.
I searched in EJB specs, all I found that is to throw a Application exception will not doom the transaction. I don't see it mentions anywhere if to throw an EJBException will doom the Tx.
So I am at a loss, can somebody share some insight on this?
-David
 
David Yuan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, I found out the answer. The EJB specs does say to throw an EJBException will doom the Tx.
In section "18.2.2 System Exceptions", it says:
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.
-David
 
author
Posts: 154
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An EJBException indicates a problem within the container itself (e.g. you are trying to access an object that no longer exists), rather than an application (business logic) issue.
If an EJBException is thrown it indicates a bug in your code or the configuration of the container. The transaction will not be committed.
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this out - http://www.valoxo.ch/jr/ExceptionHandling.pdf
 
David Yuan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ajith,
Thanks! The .pdf is great!
-David.
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic