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

    Problem session Hibernate and JBoss

    tads Newbie

      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