0 Replies Latest reply on Apr 4, 2005 8:52 AM by Osten Forshed

    Own transaction handling?

    Osten Forshed Newbie

      Hi!

      I have a POJO, used by a BMT Session Bean, where some blocks of the code needs to be executed in a transaction...

      The POJO has no handle to the calling Session Bean and its UserTransaction, so my question is: how should I do to obtain a proper UserTransaction?

      Is it safe to use:

      UserTransaction userTransaction = (UserTransaction) m_jndiContext.lookup("UserTransaction");


      ...considering the statement in the JBoss 4.0 Guide:

      Note: For BMT beans, do not obtain the UserTransaction interface using a JNDI lookup. Doing this violates the EJB specification, and the returned UserTransaction object does not have the hooks the EJB container needs to make important checks.


      I tried that as well but it seems to just messes it all up, the transactions seems not to be comitted properly and hangs for 10 mins...

      I would be very greatful for any advice how to do this correctly in the EJB/JBoss world!!!

      Thx,
      Osten