0 Replies Latest reply on Jul 9, 2010 3:25 PM by Dave Bredesen

    calling a transactional helper method from within a non-transactional EJB method

    Dave Bredesen Newbie

      So I'm trying to call a transactional helper method from within a non-transactional EJB3 service method.  Since the EJB method has no transaction, a new one cannot be created through the local call to the helper method, because there is no txn wrapper initiated by the container.

      The usual way around this is to get a handle to the local EJB instance via the SessionContext, and call the method through the handle.  So:
      public class MyEJB {
        @SessionContext ctx;

        public void myPublicButNonTransactionalMethod() {
          ((MyEJBLocal) ctx.getEJBLocalObject()).helperMethod();

        public void helperMethod() {
      Unfortunately, this doesn't seem to work in JBoss, and the errors are silly.  I have tried 3 different approaches:

      java.lang.IllegalStateException: NYI




      java.lang.IllegalStateException: NYI




      java.lang.IllegalStateException: Not implemented




      Isn't there any way to call the helper method to get a transaction without resorting to an Initial Context / JNDI lookup / etc??


      This is JBoss AS 5.1.0, using Hibernate.