Originally posted by karthik Guru:
1.log it,
2.mark the transaction for rollback using setRollbackOnly(),
3.Wrap it in a generic Application Exception we have defined for the application and re-throw it back to the client.
That's similar to that how we handle exceptions, but the spec says somethin else:
Application Exceptions:
"Enterprise bean business methods use application exceptions to inform the client of abnormal application-
level conditions, such as unacceptable values of the input arguments to a business method. A client
can typically recover from an application exception. Application exceptions are not intended for reporting
system-level problems."
System Exceptions:
"Examples of such exceptions and errors are: failure to obtain a
database connection, JNDI exceptions, unexpected RemoteException from invocation of other
enterprise beans[31], unexpected RuntimeException, JVM errors, and so on."
and
"If the bean method performs an operation that results in a checked exception[32] that the bean
method cannot recover, the bean method should throw the javax.ejb.EJBException
that wraps the original exception."
(The EJBException is a subclass of RuntimeException and therefor unchecked.)
The last quote from the spec is what I'm curios about.