我正在使用 maven-java-spring 和石英调度和 spring-jdbc 模板。
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>1.7.3</version>
</dependency>
我们有使用石英调度程序作业进行大量插入的过程。
当我在插入 x 条记录后执行作业时,它会引发如下异常
exception caught: org.springframework.transaction.TransactionSystemException: Could not commit JDBC transaction; nested exception is java.sql.SQLException: commit() should not be called while in auto-commit mode.
at org.springframework.jdbc.datasource.DataSourceTransactionManager.doCommit(DataSourceTransactionManager.java:270)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:754)
at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:147)
以下是我的 sechdular 代码
<!-- Spring jobs -->
<bean id="wireJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="search"/>
<property name="targetMethod" value="executeWireSearch"/>
</bean>
<bean id="nonWireJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="search"/>
<property name="targetMethod" value="executeNonWireSearch"/>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<list>
<ref bean="wireQuartzTrigger"/>
<ref bean="nonWireQuartzTrigger"/>
</list>
</property>
</bean>
它与自动提交相关的石英属性有关吗?