0 Replies Latest reply on Apr 8, 2005 7:51 AM by ramses

    No hibernate transaction are supported in MBeans

    ramses

      I use a Hibernate session in a MBean method in the following way:

      InitialContext context = new InitialContext();
      SessionFactory factory = (SessionFactory) context.lookup(SESSION_FACTORY_JNDI_NAME);
      session = factory.openSession();
      Transaction tx = session.beginTransaction();
      try {
       MyDAO o = (MyDAO) session.load(MyDAO.class, "key1", LockMode.UPGRADE);
       ....
       tx.commit();
      } catch (Exception e) {
       tx.rollback();
      }
      


      But autocommit of the underlying JDBC connection is true, and the record is not locked during the processing.
      The Transaction is an JTATransaction.

      When I set autocommit to of manually, then the record is locked, but the tx.commit does not pass the commit to the underlying JDBC connection.

      Maybe a missing configuratin for the TransactionManager or UserTransaction.

      Who have any ideas?

      Thank you for your assistence.
      Ramses