简体   繁体   English

Quartz作业未更新数据库

[英]Quartz job is not updating database

I have triggered Quartz job pragmatically. 我已实用地触发了Quartz工作。 But it's not looking updating the database. 但这并不是在更新数据库。 I mean, " PREV_FIRE_TIME " column is not getting updated. 我的意思是,“ PREV_FIRE_TIME ”列没有更新。 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. 提前致谢。

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. 当石英拿起工作并运行execute方法时,它位于另一个线程中。您需要将其包装在事务中。 In spring I would have set the transaction advice around the execute method . 在春季,我将围绕execute方法设置交易建议。 Alternarively you can set the below property true in quartz which should do the job for you: 或者,您可以在石英中将以下属性设置为true,这应该可以为您完成工作:

org.quartz.scheduler.wrapJobExecutionInUserTransaction=true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM