0

I have triggered Quartz job pragmatically. But it's not looking updating the database. I mean, "PREV_FIRE_TIME" column is not getting updated. I have run the following code.

stdScheduler.triggerJob(jobName,jobGroupName);

Though, during normal schedule execution database is getting updated but if I make an Ad hoc run, it's not updating the database. Could any one please suggest.

Thanks in advance.

abhijit nag
  • 451
  • 6
  • 24

1 Answers1

1

I suspect that your job class is not running under the transaction. When quartz picks up the job and runs the execute method it is in a different thread.You need to wrap it under transaction. In spring I would have set the transaction advice around the execute method . Alternarively you can set the below property true in quartz which should do the job for you:

org.quartz.scheduler.wrapJobExecutionInUserTransaction=true
Tomasz Nurkiewicz
  • 334,321
  • 69
  • 703
  • 674
Rips
  • 1,964
  • 1
  • 23
  • 45
  • @tomasznurkiewicz how to achieve the same in spring 4 with annotation based configuration. Please [see](http://stackoverflow.com/questions/41213446/how-to-run-update-query-in-spring-jpa-for-quartz-job) my question – pise Dec 18 '16 at 22:21