This week's book giveaway is in the Agile and Other Processes forum. We're giving away four copies of Darcy DeClute's Scrum Master Certification Guide: The Definitive Resource for Passing the CSM and PSM Exams and have Darcy DeClute on-line! See this thread for details.
The container always invokes ejbRemove() on session beans within an unspecified transaction context. This means that the container does not have to rollback any transaction in case RemoveException is thrown (section 7.6.1).
For entity beans the story is a little different as explained in sections 10.5.2 and 10.5.3. Moreover, 10.5.8.5 states the following:
From the client�s perspective, a RemoveException (or a subclass of RemoveException) indicates that an application level error occurred during a remove(...) operation. If a client receives this exception, the client does not know, in general, whether the entity object was removed or not. The client also does not know if the transaction has been marked for rollback. (However, the client may determine the transaction status using the UserTransaction interface.)
The Container or Bean Provider throws the RemoveException (or subclass of RemoveException) from a remove method to indicate an application-level error from the entity object removal operation. Optionally, the Container or Bean Provider may mark the transaction for rollback before throwing this exception.
The Container or Bean Provider is encouraged to mark the transaction for rollback only if data integrity would be lost if the transaction were committed by the client. Typically, when a RemoveException is thrown, it leaves the database in a consistent state, allowing the client to recover. The Container treats the RemoveException as any other application exception.