0 Replies Latest reply on Nov 16, 2004 6:05 AM by shanika

    JTA Transaction doesn't rollback Hibernate sessions

    shanika

      Hibernate version: V2.1.6

      Name and version of the database : Oracle 8

      JBoss : V4.0.0

      I have configured Hibernate in JBoss through .har deployer and get the session by the JNDI to the session factory. All working fine except for Transactions.

      I use JTA and have given my Transaction demarcation in the deployment descripter of my stateless session bean as :

      <container-transaction>
       <method>
       <ejb-name>Request</ejb-name>
       <method-intf>Remote</method-intf>
       <method-name>executeProcess</method-name>
       </method>
       <trans-attribute>Required</trans-attribute>
      </container-transaction>
      



      Ideally i need the container to rolback the transaction if anything goes wrong withing the method "executeProcess", which does not happen currently in my application. In that method, i call session.save method several times, but if one save operation fails, it doesn't rollback all the other save operations, which is want i'm trying to acieve.

      I understand that when the :
      session = HibernateContext.getSession("java:/hibernate/SessionFactory");
      session.save(dao);
      


      - gets called several times withing the same transaction, the sessions used get bound to the current context which means to the current JTA transaction. Then why won't the transaction gets rolled back with all the save commands that took place?

      Am i missing something in my JBoss JTA configurations? If so can anyone give me some hints on configuring JTA on JBoss.

      Thanks alot for considering my issue.