File tree 2 files changed +6
-15
lines changed
spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao
2 files changed +6
-15
lines changed Original file line number Diff line number Diff line change 74
74
* @author Dimitrios Liapis
75
75
* @author Philippe Marschall
76
76
* @author Jinwoo Bae
77
+ * @author Yanming Zhou
77
78
*/
78
79
public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements JobExecutionDao , InitializingBean {
79
80
@@ -319,11 +320,8 @@ public void updateJobExecution(JobExecution jobExecution) {
319
320
320
321
// Avoid concurrent modifications...
321
322
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 () + ")" );
327
325
}
328
326
329
327
jobExecution .incrementVersion ();
Original file line number Diff line number Diff line change 66
66
* @author Mahmoud Ben Hassine
67
67
* @author Baris Cubukcuoglu
68
68
* @author Minsoo Kim
69
+ * @author Yanming Zhou
69
70
* @see StepExecutionDao
70
71
*/
71
72
public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implements StepExecutionDao , InitializingBean {
@@ -100,11 +101,6 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
100
101
WHERE JE.JOB_INSTANCE_ID = ? AND SE.STEP_NAME = ?
101
102
""" ;
102
103
103
- private static final String CURRENT_VERSION_STEP_EXECUTION = """
104
- SELECT VERSION FROM %PREFIX%STEP_EXECUTION
105
- WHERE STEP_EXECUTION_ID=?
106
- """ ;
107
-
108
104
private static final String COUNT_STEP_EXECUTIONS = """
109
105
SELECT COUNT(*)
110
106
FROM %PREFIX%JOB_EXECUTION JE
@@ -287,11 +283,8 @@ public void updateStepExecution(StepExecution stepExecution) {
287
283
288
284
// Avoid concurrent modifications...
289
285
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 () + ")" );
295
288
}
296
289
297
290
stepExecution .incrementVersion ();
You can’t perform that action at this time.
0 commit comments