Win a copy of Head First Android this week in the Android 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:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

HFEJB Question

 
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HFEJB Pno-556
I am not able to solve below given points-:

A bean realizes it cannot commit a transaction,but it does not want the client to get an exception.what can the bean do?

A bean wants the client to get an application exception but the bean still wants the transaction to commit.what should bean do?

Please Help
Thanks
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

A bean realizes it cannot commit a transaction,but it does not want the client to get an exception.what can the bean do?

A bean wants the client to get an application exception but the bean still wants the transaction to commit.what should bean do?



I can think of this,

If the bean throws system exception, transaction will rollback and an exception will be thrown to client. We dont want this.

The only way is to call setRollbackOnly() and mark the transaction to rollback.


Regarding the second one,
If our method has declared the application exception in the signature
and throws it, the container will not rollback the transaction and
throw the exception to client.

What do you think? Is it right?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic