1 Reply Latest reply on Apr 12, 2005 9:49 PM by adrian.brock

    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?

      My testenvironment is JBoss 4.0.1, Hiberante 2.1.6, MySQL 4.1.5-gamma with innodb tables.

      Thank you for your assistence.
      Ramses