• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt on EJBExceptiion and EJB Transaction Rolledback Exception

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,

Can someone please explain why Container throws 2 different (EJBExceptiion and EJBTransactionRolledbackException) exceptions in case of System exception in bean(CMT) method upon the transaction context of caller?

ie, why container throws EJBExceptiion if TM creates a new transaction for bean, while throws an EJBTransactionRolledbackException if TM does not create new transaction for bean.

My question is yhy container throws 2 instead of 1 EJBTransactionRolledbackException or EJBExceptiion?

(Refer sec 14.3.1 of ejb spec)

Thanks
Cham

[ October 25, 2008: Message edited by: Chaminda Amarasinghe ]
[ October 25, 2008: Message edited by: Chaminda Amarasinghe ]
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Folks,

After a bit deeper thinking about the concept behind this I could come up with answer for my own question. Please correct me if Im wrong

If callee shares callers transaction it is important to inform the caller that callee shared caller's transaction but cause by an exception, so sets the transactionRalledBack and throws EJBTransactionRolledbackException and on other hand it does not make sense seting transactionRalledBack or throwing EJBTransactionRolledbackException if callee does not share caller's transaction instead of throwing an EJBException.

Thanks
Cham
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EJBTransactionRolledbackException is thrown to inform the caller that his transaction has been rolled back. If the callee has a transaction of his own, the caller doesn't care about that, so an EJBException is thrown instead.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Christophe Verre
 
There are 29 Knuts in one Sickle, and 17 Sickles make up a Galleon. 42 tiny ads in a knut:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic