1 Reply Latest reply on Mar 22, 2007 10:14 AM by grego1

    long running transaction

    grego1

      Hi

      I'm writing an application that processes a huge amount of data. I want to kick this off in the middle of the night with a timer service inside of the app server so that the slsb can chew on the problem set for a few hours and shove data into the database when needed.

      Now, the issue is the transaction times out. It's a bad idea to extend the transaction timeout to hours, so I figured I would bracket the database work by opening and closing the transaction (since I know where the delimiters are).

      Ok, so Seam isn't letting me do things like:

      while(moreDataToProcess) {
       someProcessing();
      
       entityManager.getTransaction().begin();
       ...
       entityManager.persist(obj);
       entityManager.getTransaction().commit();
      
       otherProcessing();
      }
      


      giving an error of:
      ERROR [org.jboss.ejb.txtimer.TimerImpl] Error invoking ejbTimeout: javax.ejb.EJBException: java.lang.IllegalStateException: Illegal to call this method from injected, managed EntityManage


      There must be a way to tell Seam to quick trying to control the transaction inside of a particular slsb (or for the whole app server) - but for the life of me I can't find documentation or posts on how to do that.

      Any pointers to docs or posts, or comments on how to approach this?

      Thanks,
      Greg