4 Replies Latest reply on Aug 25, 2010 6:40 AM by jaikiran pai

    setRollbackOnly() not rolling back completely

    M Arnold Newbie

      I have an MDB using container managed transactions (REQUIRED) which calls methods in a stateless session bean (also container managed transaction and REQUIRED) which in turns makes JDBC calls to make database changes.


      In the session bean, if it gets a SQLException making JDBC calls, I call setRollbackOnly(), and rethrow the exception.  When the MDB gets this SQLException, it also calls setRollbackOnly(), though I understand thats not necessary, since the session bean should've inherited its transaction, which it marked to rollback.


      What I see when a SQLException occurs, is that the message is still on the queue (so the JMS dequeue is rolled back) but the database changes are committed.


      I expect to see both the JMS dequeue and the JDBC calls rolled back together... so this is very troubling!


      I'm using JBoss 5.1 JRE 6, Oracle 10gR2, an XA DataSource.  There are no JDBC commits in my code.  All CallableStatements, Connections are closed properly.


      I would really appreciate some help, or some guidance on how to investigate further as I am stuck.


      If I'm not doing something wrong that's immediately obvious, I can try to reduce to a small repeatable test case.


      Thanks, Malcolm