• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Unexpected exception can be handled safely ?

 
Diego Amicabile
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Mikalai Zaikin' SBCD Study guide, 12.0

QUOTE: An application exception thrown by an enterprise bean instance should NOT automatically rollback a client's transaction. The client should typically be given a chance to recover a transaction from an application exception.

Ok, but...

QUOTE : An unexpected exception that may have left the instance's state variables and/or underlying persistent data in an inconsistent state can be handled safely.

I miss the point here Does it mean that the client may do the rollback himself when an unexpected application exception happens in the bean, and may also catch the exception and ignore it ?

Regards
Diego Amicabile
 
Chengwei Lee
Ranch Hand
Posts: 884
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if the client caught an application exception & realized that even if it could continue, the transaction would never commit. Or if it tried to update the underlying database, the data integrity would be compromised?

The client could/should initiate the roll back itself, isn't it?

Technically, the client could catch it, ignore it, do an update & corrupt the database. But at the end of the day, someone has to fix it (but thats another story).

But does it make sense for the client to press on if the outcome is fruitless & may result in dire consequences?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic