title: Debugging transactions in Java EE
body: <p>I have an @Stateless EJB method in which I </p>
  
  <ol>
  <li>delete some entries from a database
  using JPA <code>remove()</code>'s </li>
  <li>throw an Exception that is annotated as <code>@ApplicationException(rollback=true)</code></li>
  </ol>
  
  <p>I have no other transaction-specific annotations for the method (I set <code>@TransactionAttribute(TransactionAttributeType.REQUIRED)</code> but that should be the default anyway!). Transactions are container managed. JPA provider is EclipseLink.</p>
  
  <p>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)?</p>
  
  <p>I also tried to call <code>SessionContext.setRollbackOnly()</code>, with the same result.</p>
  
  <p>How can I debug this problem?</p>
  
  <p>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...</p>