1 Reply Latest reply on Jun 18, 2004 7:38 AM by tads

    Problem session Hibernate and JBoss

    tads

      Hi,

      I´m using Hibernate 2.0.2, Oracle 8.1.7 and JBoss 3.2.3.

      I have a method as follows:

      
      // Obs.: the attribute dsTest of test is updated in called of
      the method insertTest(..)
      
      
      public void insertTest(Test test)
      {
       Session session = null;
       Transaction tx = null;
      
       try
       {
       session = dataSource.openSession();
       tx = session.beginTransaction();
      
       session.update(test, session);
      
       // gets from database
       Test aux = session.load(Test.class, test.getIdTest());
      
       // if the object from database (aux) is different than test
       if (!test.getDsTest().equals(aux.getDsTest()))
       {
       session.update(teste.getOtherObject(), session);
       }
      
       tx.commit();
      .
      .
      .
      
      }
      
      


      Out of JBoss, the method is correct, but in JBoss
      The method updates the test and when gets from the database, the data
      of test is already updated, but I didn´t commit the transaction.

      What is wrong???
      Somebody can help mee please?

      Thanks

        • 1. Re: Problem session Hibernate and JBoss
          tads

          Ho, sorry... I forgot...

          I was created a service in JBoss with MBean
          and I´m using JTATransaction. It seems that it is using this Transaction Manager and the first sess.update was commited before
          tx.commit().