Hi, I just would like to point out that concerning handling system exceptions, HFE p.546 is perhaps not enough precise. It is said that in this case, the transaction is generally rolled back. But of course, it depends on the existence of a transaction context. By example, for message driven bean's method running in NOT SUPPORTED transaction attribute, if a system exception is thrown, no transaction rollback happens and only exception logging + discarding instance do happen. It would have been great to detail more the scenario dealing with the different transaction contexts. By example, with MANDATORY transaction attribute for a session or entity bean, in case of system exception, a TransactionRolledbackException (Remote) or TransactionRolledbackLocalException(Local) should be thrown by the container whereas in case of REQUIRESNEW, only RemoteException(Remote) or EJBException (Local) will be sent... All this is detailed p.375-p.378 of the EJB 2.0 spec. It doesn't change anything to the fact that HFE is really a excellent book;-) REgards, Cyril. [ April 11, 2004: Message edited by: cyril vidal ]
SCJP 1.4, SCWCD, SCBCD, IBM XML, IBM Websphere 285, IBM Websphere 287
Actually, I was thinking of this very subject today. It would also have been good if the book had contrasted the handling of exceptions thrown by a business method of a bean with container-managed transaction with what happens when a client calls a bean which has an invalid transaction attribute. This is what I am thinking of. If the client calls a bean (whose transaction attribute is set to Mandatory) without a transaction context, the Container throws the javax.transaction.TransactionRequiredException exception if the client is a remote client, or the javax.ejb.TransactionRequiredLocalException if the client is a local client. If the client calls a bean (whose transaction attribute is set to Never) with a transaction context, the Container throws the java.rmi.Remote-Exception exception if the client is a remote client, or the javax.ejb.EJBException if the client is a local client.
[ April 11, 2004: Message edited by: Roger Chung-Wee ]
Actually, HFE told about this. cf p.558 in the transaction scenario: Client calls a method on a Remote CMT bean, and the method is marked Mandatory. The caller does not have a transaction context in place when the call comes in The client gets a TransactionRequiredException (a local client would get a TransactionRequiredLocalException). Regards, Cyril. [ April 12, 2004: Message edited by: cyril vidal ]