abhijit nag
abhijit nag

Reputation: 381

Quartz job is not updating database

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.

Upvotes: 0

Views: 3498

Answers (1)

Rips
Rips

Reputation: 2004

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

Upvotes: 1

Related Questions