1 Reply Latest reply on Sep 22, 2008 8:15 PM by gjeudy

    No Transaction in ActionHandler

    sirlantis

      Hello everybody,


      I am currently writing an ActionHandler for my jBPM process. This ActionHandler is invoked by an async timer. What the handler does is:


      @Transactional
      function execute()
      {
           entityManager = Component.getInstance(...)
           stuff = getStuffInstanceFromProcess
           message = entityManager.findUnprocessedMessages
           whatToDo = parse(message);
           stuff.update(whatToDo);
           message.setProcessed(true);
           
           entityManager.merge(message);
           entityManager.merge(stuff);
      }
      



      Now the problem is, that neither the message nor the stuff is updated. I believe that's because there is no transaction active (since entityManager.flush raises an no-transaction-exception). Also, Seam does not have any interceptors around my callstack, which would flush a transaction automatically.


      As a sidenote: I already tried to annotate my handler class with the following:


      @Stateless
      @Name("checkForExecutableMessages")
      @Interceptors(SeamInterceptor.class)
      



      Anybody knows, what I could do about it?


      Thanks in advance,
      Marcel

        • 1. Re: No Transaction in ActionHandler
          gjeudy
          @Transactional

          annotation is for use with non-EJB components only.


          Is your async timer an EJB3 timer ?


          If you turn your handler class into a stateless EJB, thats how you did it with

          @Stateless

          then the default transactional behavior is REQUIRED and should work.


          I don't know why you put

          @Interceptors(SeamInterceptor.class

          I don't think you should put this directly. The
          @Name

          annotation is sufficient to make it a Seam managed component.


          Are you running inside jboss 4.2.2 ?