2 Replies Latest reply on Feb 7, 2003 9:14 AM by methodman

    how to get UserTransaction from a client

    luckystar_007

      Hi,all.I am searching a solution: Can a client program
      not in EJB(the program in another JVM) get the Usertransaction from JBoss?

        • 1. Re: how to get UserTransaction from a client

          Object o = new InitialContext().lookup("UserTransaction");
          UserTransaction ut = (UserTransaction)PortableRemoteObject.narrow(o, UserTransaction.class);

          Regards,
          Adrian

          • 2. Re: how to get UserTransaction from a client
            methodman

            Excerpt From the AdminDevelopers Book 3.0.5:

            The JTA javax.transaction.UserTransaction interface allows applications to explicitly control transac-tions.
            For enterprise session beans that manage transaction themselves (BMT), a UserTransaction can
            be obtained by calling the getUserTransaction method on the bean context object, javax.ejb.Session-Context.
            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.