0 Replies Latest reply on Apr 8, 2005 4:34 PM by mjgreene550

    setRollbackOnly not rolling back

    mjgreene550

      I'm using JBoss 4.0.1 with MySQL 4.1.8. I also checked to make sure all my tables were InnoDB.

      For some reason or another, the following code does not rollback changes made to the myEJB entity bean:

      /**
       * @ejb.interface-method view-type = "both"
       * @ejb.transaction type = "Required"
       */
      public void completeRequest(MyDTO dto) throws MyException {
       myEJB.setApprovedBy(approvedBy);
       myEJB.setApprovedAmount(amount);
       myEJB.setDateApproved(currentTime);
       myEJB.setStatus(REQUEST_COMPLETED);
       myEJB.setComments(dto.getComments());
      
       try {
       ....(call to another session facade)
      
       } catch (MyException e) {
       context.setRollbackOnly();
      
       throw e;
       }
       }
      }
      


      However, If I execute the following SQL against the same table the bean represents the trasnsaction rollback works fine:

      BEGIN;
      INSERT INTO myTable(subject)
      VALUES ('test');
      ROLLBACK;
      


      I also got the TRACE output from JBoss when my sessionbean throws MyException:
      16:14:03,015 DEBUG [MyEJB#findRequestsByStatus] Executing SQL: SELECT t0_o.requestID FROM myTable t0_o WHERE (t0_o.status = ?)
      16:14:03,015 DEBUG [MyEJB#findRequestsByStatusAndType] Executing SQL: SELECT t0_o.requestID FROM myTable t0_o WHERE (t0_o.status = ? AND t0_o.type = ?)
      16:14:31,656 DEBUG [FinanceRequestBean] Executing SQL: UPDATE myTable SET comments=?, status=? WHERE requestID=?
      


      Any ideas on how to solve this? Thanks for your time.