posted 19 years ago
Hi
I want to revise my previously statement that (2) is "wrong" to (2) is "right" and this is because while reading EJB specs, I have come across this:
If a client program receives an app exception from an EJB invocation while the client is associated with a tx, the client can typically continue the tx because an app exception does not automatically cause the container to mark the tx for rollback.
Although the container does not automatically mark for rollback a tx because of a thrown app exception, the tx might have been marked for rollback by the EJB instance before it threw the app exception.
There are two ways to learn if a particular app exception results in tx rollback or not:
� Statically. Programmers can check the docs of the EJB�s home or component interface. The Bean Provider may have specified the app exceptions for which the EJB marks the tx for rollback before throwing the exception.
� Dynamically. Clients that are EJB with container-managed transaction demarcation can use the getRollbackOnly method of the javax.ejb.EJBContext object to learn if the current tx has been marked for rollback; other clients may use the get-Status method of the javax.transaction.UserTransaction interface to obtain the tx status.
Thanks
-- Ravi
[ March 28, 2005: Message edited by: Ravindra Janapareddy ]
SCJP, SCJD, SCWCD, SCBCD, SCEA