Skip to content

Commit 4dddb10

Browse files
marschallfmbenhassine
authored andcommitted
Make countStepExecutions access batch_job_execution only once
Change JdbcStepExecutionDao.COUNT_STEP_EXECUTIONS to access the table batch_job_execution only once. Issue #3876
1 parent f689901 commit 4dddb10

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: spring-batch-core/src/main/java/org/springframework/batch/core/repository/dao/JdbcStepExecutionDao.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,9 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
105105
"STEP_EXECUTION_ID=?";
106106

107107
private static final String COUNT_STEP_EXECUTIONS = "SELECT COUNT(*) " +
108-
" from %PREFIX%JOB_EXECUTION JE, %PREFIX%STEP_EXECUTION SE" +
109-
" where " +
110-
" SE.JOB_EXECUTION_ID in (SELECT JOB_EXECUTION_ID from %PREFIX%JOB_EXECUTION " +
111-
"where JOB_INSTANCE_ID = ?)" +
112-
" and SE.JOB_EXECUTION_ID = JE.JOB_EXECUTION_ID " +
108+
" from %PREFIX%JOB_EXECUTION JE JOIN %PREFIX%STEP_EXECUTION SE " +
109+
" on SE.JOB_EXECUTION_ID = JE.JOB_EXECUTION_ID " +
110+
"where JE.JOB_INSTANCE_ID = ?" +
113111
" and SE.STEP_NAME = ?";
114112

115113
private int exitMessageLength = DEFAULT_EXIT_MESSAGE_LENGTH;

0 commit comments

Comments
 (0)