As javax.ejb.EJBException is a subclass of RuntimeException, the EJB container will automatically rollback the transaction if you are using container-managed transactions.
You may decide that you do not want this to happen, so you just need to encapsulate EJBException in an instance of Exception or a subclass of it (but not RuntimeException) and throw that exception. The EJB container will not automatically rollback the transaction, so you will have to invoke setRollbackOnly() if you want a rollback.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
Joined: May 19, 2005
what about in case of RemoteException which is thrown by remote and well as local beans.
Joined: Sep 29, 2002
What you say is not correct. The EJB container throws RemoteException to a remote client or EJBException to a local client.