• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Application Exception & Transaction

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Something about exceptions in EJB bugs me down.

In Head First EJB page 542 they say

Remember, the Container won't rollback a transaction just because there's an application exception. With an application exception, the Container assumes that the whole thing might be recoverable, and that the transaction can continue.


I understand how the Container decides to commit instead of roll back once the bean throws an application exception instead of system exception. But to continue the transaction??? How can this happen? Once the bean throws the application exception to the Container, the method running in the Container (for which the transaction has started), stops executing, and then the Container forwards the exception to the remote client. And just before it sends it, it seems reasonable to me that the Container decides to end the transaction (with commit, not rollback, because it's an application exception).
So how can they say that the transaction proceeds after the Container throws the exception to the client?


[ October 19, 2007: Message edited by: Joseph Sweet ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic