0 Replies Latest reply on Apr 25, 2014 1:28 PM by David Baddeley

    Commit transaction mid-method from EJB @MessageDriven

    David Baddeley Newbie



      I have a long running process which runs inside a Seam component that takes about 60sec to complete, to allow its progress to be displayed I write to the database during its execution.

      When the process is invoked from a JAXRS bean the process works fine and the database is getting updated instantly

      But when the processing is invoked from a Quartz scheduled job (using a @MessageDriven) the updates only appear in the database once the method completes

      Can somebody explain the reason behind this and is there anyway around it? I have tried adding @TransactionAttribute(REQUIRES_NEW) to the MDB but this doesn't have any effect

      This is running on SEAM 2.2.2 and I am using a SMPC

      The scheduled task looks like this...



           activationConfig = {

                @ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "11 * * * * ?")





      public class MinuteActions implements Job{


           @Logger private Log log;

           @In private ProcessSession processSession;


           public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException{




      And this is the processing (Seam) bean



      public class ProcessSession{

           @Logger private Log log;

           @In private SessionDAO sessionDAO;

           public ProcessingRun processNewSession(Session session){

                session.setProcessingStartTime(new Date());


                //Some long running processing ~60sec

                session.setProcessingEndTime(new Date());




      Ps. also posted on StackOverflow: http://stackoverflow.com/questions/23280298/ejb-mdb-cannot-persist-data-mid-method