Win a copy of Pipeline as Code this week in the Cloud/Virtualization 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
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

HFE 556 POINT:5

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A bean realises it cant commit a transaction ,but it does'nt want the client to get an exception.what can the bean do?
what does the question mean?
I think....there is a TransactionRolledBackException() if the caller is also is in the same context...so use a try/catch to catch the exception and not let the exception propagate to the container ..and then to the client.am I correct?
please throw some light
thanks
Pradeep
 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A bean realises it cant commit a transaction ,but it does'nt want the client to get an exception.what can the bean do?


You can simply invoke setRollbackOnly() on EJBContext .
Transaction is rolledback in two ways:
- bean throws system exception - very bad way (the bean is dead)
- invoke setRollnackOnly() on EJBContext for CMT || invoke getUserTransaction().setRollbackOnly() for BMT.
 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
TransactionRolledbackException is itself a system exception and thus should never be caught in your bean.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
SKIP - a book about connecting industrious people with elderly land owners
https://coderanch.com/t/skip-book
reply
    Bookmark Topic Watch Topic
  • New Topic