2 Replies Latest reply on Jun 3, 2006 8:11 AM by Joris Wijlens

    jta transaction doesnt rollback hibernate update in case of

    sheida sadrai Newbie

      I am using hibernate3, EJB3.0 in jboss-4.0.3SP1. I want jta does all transaction. But, if my ejb cause an exception my hibernate update doesnt rollback.
      I dont have any transaction control in my hibernate. and I get the session from session = getSessionFactory().getCurrentSession();
      and I dont close session.

      Here is my jboss-service.xml:
      -------------------------------------


      jboss.jca:service=RARDeployer
      jboss.jca:service=LocalTxCM,name=MySqlDS
      java:/MySqlDS
      org.hibernate.dialect.MySQLDialect
      java:/hibernate/HibernateFactory
      true
      org.hibernate.cache.EhCacheProvider
      false
      org.hibernate.transaction.JTATransactionFactory
      org.hibernate.transaction.JBossTransactionManagerLookup
      true
      true
      java:/UserTransaction

      mappings/Users.hbm.xml,
      mappings/UserTable.hbm.xml,
      mappings/ZoneStates.hbm.xml
      ...



      ------------------------------------------------
      And my stateless session bean is like this:

      @Stateless
      @Local(AdminInt.class)
      public class AdminBean implements AdminInt{
      ...
      -------------------------
      and the method of ejb is like this:

      @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
      public boolean editBedType(BedType bedtype){
      BedTypeDAO dao = new BedTypeDAO();
      try {
      dao.update(bedtype);
      int i=100/0;//here I cause an exception. but the update doesnt rollback
      } catch (Exception e) {
      e.printStackTrace();
      }
      ...