Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question on TransactionRolledback Exception

 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lets say a client carrying a transaction context, calls a business method on CMT bean and this business method throws NullPointerException while executing.

If this is correct scenario in which the Container throws TransactionRolledbackException to client, what about NullPointerException that is thrown in business method. Does it wrapped in TransactionRolledbackException?

Thanks,
Prashant
 
Vijay Dasari
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

When a client calls a business method with in a transaction (clients tx),
the Container Behaves in two ways depending on the transactional attribute of the business method.

The Spec never says that TransactionRolledbackException wraps the original system exception in this scenario.

But in case of MessageDrivenBeans, they say that conatiner has to wrap the original exception.

Vijay.
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it means wraping of original message in TransactionRolledbackException is vendor dependent in case of session beans.

Thanks Vijay.

--Prashant
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
other experts please confirm.
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it means wraping of original message in TransactionRolledbackException is vendor dependent in case of session beans.

Correct. All the client knows for sure is that it is pointless to continue with the transaction.

Note that TransactionRolledbackException is thrown to remote clients for CMT session or entity beans when the bean's business method runs in the context of the caller�s transaction.
 
Amos Coats
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think if the beanmethod encounters a NullPointerException, the bean will be discarded since this is SytemException, and the client will recieve a RemoteException or a EJBException. What the client does with its own transaction is up to the client.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic