0 Replies Latest reply on Sep 6, 2006 4:09 PM by James Plessinger

    Sharing JTA between hibernate session and BMT

    James Plessinger Newbie

      Hope this is the right forum.

      I am trying to share a transaction between hibernate and a session bean.

      Somewhere I call

      Session session = this.factory.openSession();

      Through out the application I need access to this transaction and prefer
      to have access to it with out passing the session object.

      I tried to do this first with the code below and it works fine, but futher
      reading has told me not to.
      UserTransaction tx = (UserTransaction) ejbContext.lookup("java:comp/UserTransaction");

      So I use the code provided from examples and do
      UserTransaction tx = ejbContext.getUserTransaction();

      This causes two problems, first the tx is a diffrent tx and a calls to
      sessionFactory.getCurrentSession() fails with

      org.hibernate.HibernateException: Unable to locate current JTA transaction