I have an @Stateless EJB method in which I
- delete some entries from a database
using JPA
remove()
's - throw an Exception that is annotated as
@ApplicationException(rollback=true)
I have no other transaction-specific annotations for the method (I set @TransactionAttribute(TransactionAttributeType.REQUIRED)
but that should be the default anyway!). Transactions are container managed. JPA provider is EclipseLink.
And still, the transaction is not rolled back when the exception is thrown. Eg. the entries that I deleted from the database before the rollback don't come back. Btw. I call entityManager.flush() before the throw, can it cause such behaviour (it shouldn't)?
I also tried to call SessionContext.setRollbackOnly()
, with the same result.
How can I debug this problem?
I'm using Glassfish v3 and Netbeans for debugging, but I'd be equally happy with println's I just don't know where to put them...