2 Replies Latest reply on Sep 20, 2004 10:51 AM by canghel

    Transaction rollback not working for CMP with mysql


      hello ppl,

      The problem:
      Transactions are just not rolledback in case of an Exception when using CMP 2.x and CMT with mysql.

      I have a simple Entity bean being created through a session bean funcction... Now inside the session func, after creating the entityobject i am throwing a EJBException... which should cause the entity creation to rollback... but it doesnt. (with a hypersonic DS it does a perfect rollback)
      The transaction attributes are 'Required' for both the EJBs.

      This was being discussed previously at the following location:

      Maybe there is something in my mysql datasource configuration that i have left out since the DD's remain the same. I am otherwise using the standard configuration thats given in the jboss examples folder.
      I have previously used transactions in mysql with plain sql over jdbc and they work fine there.

      Does not using a XADatasource have anything to do with this ?
      I have also tried using ctx.setRollbackOnly()... but without success.

      i am using Jboss 3.2.3 with mysql 4.0.14 with the 3.0.15 jdbc connectors for mysql.
      If it would be useful.. i can upload my code and the xmls on the net.

      any ideas ? anyone..
      PS: should i post this under JCA/JBoss topic also ?

        • 1. Re: Transaction rollback not working for CMP with mysql SOLV

          SOLVED !!!

          The whole problem was that if we set the


          option in jbosscmp-jdbc.xml the the tables created by the container are of type MyISAM... and MySql supports transaction only on Tables of type InnoDB... so if you change the type of your tables to InnoDB everything should work fine.

          I think there is an option somewhere to make sure that the tables created are of the type InnoDB maybe in conf/standardjbosscmp-jdbc.xml or somewhere.
          Anyone aware of this ?

          Thanks to Anubha for the solution and to Siddharth for his help.


          • 2. Re: Transaction rollback not working for CMP with mysql
            canghel Newbie

            Thanks for the answer. A possible solution is to start the MySQL server with option --default-table-type=InnoDB. By default the MySQL server uses MyISAM for table type and starting the server with this option changes the default type to InnoDB. I tried this and the rollback worked fine.

            best regards,