File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Application Exception & Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Application Exception & Transaction" Watch "Application Exception & Transaction" New topic

Application Exception & Transaction

Joseph Sweet
Ranch Hand

Joined: Jan 29, 2005
Posts: 327
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 ]

We must know, we will know. -- David Hilbert
I agree. Here's the link:
subject: Application Exception & Transaction
It's not a secret anymore!