File tree Expand file tree Collapse file tree 2 files changed +6
-15
lines changed
spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao Expand file tree Collapse file tree 2 files changed +6
-15
lines changed Original file line number Diff line number Diff line change 7474 * @author Dimitrios Liapis
7575 * @author Philippe Marschall
7676 * @author Jinwoo Bae
77+ * @author Yanming Zhou
7778 */
7879public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements JobExecutionDao , InitializingBean {
7980
@@ -319,11 +320,8 @@ public void updateJobExecution(JobExecution jobExecution) {
319320
320321 // Avoid concurrent modifications...
321322 if (count == 0 ) {
322- int currentVersion = getJdbcTemplate ().queryForObject (getQuery (CURRENT_VERSION_JOB_EXECUTION ),
323- Integer .class , new Object [] { jobExecution .getId () });
324- throw new OptimisticLockingFailureException (
325- "Attempt to update job execution id=" + jobExecution .getId () + " with wrong version ("
326- + jobExecution .getVersion () + "), where current version is " + currentVersion );
323+ throw new OptimisticLockingFailureException ("Attempt to update job execution id=" + jobExecution .getId ()
324+ + " with wrong version (" + jobExecution .getVersion () + ")" );
327325 }
328326
329327 jobExecution .incrementVersion ();
Original file line number Diff line number Diff line change 6666 * @author Mahmoud Ben Hassine
6767 * @author Baris Cubukcuoglu
6868 * @author Minsoo Kim
69+ * @author Yanming Zhou
6970 * @see StepExecutionDao
7071 */
7172public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implements StepExecutionDao , InitializingBean {
@@ -100,11 +101,6 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
100101 WHERE JE.JOB_INSTANCE_ID = ? AND SE.STEP_NAME = ?
101102 """ ;
102103
103- private static final String CURRENT_VERSION_STEP_EXECUTION = """
104- SELECT VERSION FROM %PREFIX%STEP_EXECUTION
105- WHERE STEP_EXECUTION_ID=?
106- """ ;
107-
108104 private static final String COUNT_STEP_EXECUTIONS = """
109105 SELECT COUNT(*)
110106 FROM %PREFIX%JOB_EXECUTION JE
@@ -287,11 +283,8 @@ public void updateStepExecution(StepExecution stepExecution) {
287283
288284 // Avoid concurrent modifications...
289285 if (count == 0 ) {
290- int currentVersion = getJdbcTemplate ().queryForObject (getQuery (CURRENT_VERSION_STEP_EXECUTION ),
291- Integer .class , stepExecution .getId ());
292- throw new OptimisticLockingFailureException (
293- "Attempt to update step execution id=" + stepExecution .getId () + " with wrong version ("
294- + stepExecution .getVersion () + "), where current version is " + currentVersion );
286+ throw new OptimisticLockingFailureException ("Attempt to update step execution id="
287+ + stepExecution .getId () + " with wrong version (" + stepExecution .getVersion () + ")" );
295288 }
296289
297290 stepExecution .incrementVersion ();
You can’t perform that action at this time.
0 commit comments