|
28 | 28 | import org.apache.commons.logging.Log; |
29 | 29 | import org.apache.commons.logging.LogFactory; |
30 | 30 |
|
31 | | -import org.springframework.batch.core.BatchStatus; |
32 | | -import org.springframework.batch.core.ExitStatus; |
33 | 31 | import org.springframework.batch.core.job.JobExecution; |
34 | 32 | import org.springframework.batch.core.job.JobInstance; |
35 | 33 | import org.springframework.batch.core.step.StepExecution; |
@@ -91,7 +89,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement |
91 | 89 | private static final String GET_STEP_EXECUTION = GET_RAW_STEP_EXECUTIONS + " WHERE STEP_EXECUTION_ID = ?"; |
92 | 90 |
|
93 | 91 | private static final String GET_LAST_STEP_EXECUTION = """ |
94 | | - SELECT SE.STEP_EXECUTION_ID, SE.STEP_NAME, SE.START_TIME, SE.END_TIME, SE.STATUS, SE.COMMIT_COUNT, SE.READ_COUNT, SE.FILTER_COUNT, SE.WRITE_COUNT, SE.EXIT_CODE, SE.EXIT_MESSAGE, SE.READ_SKIP_COUNT, SE.WRITE_SKIP_COUNT, SE.PROCESS_SKIP_COUNT, SE.ROLLBACK_COUNT, SE.LAST_UPDATED, SE.VERSION, SE.CREATE_TIME, JE.JOB_EXECUTION_ID, JE.START_TIME, JE.END_TIME, JE.STATUS, JE.EXIT_CODE, JE.EXIT_MESSAGE, JE.CREATE_TIME, JE.LAST_UPDATED, JE.VERSION |
| 92 | + SELECT SE.STEP_EXECUTION_ID, SE.STEP_NAME, SE.JOB_EXECUTION_ID, SE.START_TIME, SE.END_TIME, SE.STATUS, SE.COMMIT_COUNT, SE.READ_COUNT, SE.FILTER_COUNT, SE.WRITE_COUNT, SE.EXIT_CODE, SE.EXIT_MESSAGE, SE.READ_SKIP_COUNT, SE.WRITE_SKIP_COUNT, SE.PROCESS_SKIP_COUNT, SE.ROLLBACK_COUNT, SE.LAST_UPDATED, SE.VERSION, SE.CREATE_TIME |
95 | 93 | FROM %PREFIX%JOB_EXECUTION JE |
96 | 94 | JOIN %PREFIX%STEP_EXECUTION SE ON SE.JOB_EXECUTION_ID = JE.JOB_EXECUTION_ID |
97 | 95 | WHERE JE.JOB_INSTANCE_ID = ? AND SE.STEP_NAME = ? |
@@ -320,21 +318,9 @@ public StepExecution getLastStepExecution(JobInstance jobInstance, String stepNa |
320 | 318 | statement.setString(2, stepName); |
321 | 319 | try (ResultSet rs = statement.executeQuery()) { |
322 | 320 | if (rs.next()) { |
323 | | - Long jobExecutionId = rs.getLong(19); |
324 | | - JobExecution jobExecution = new JobExecution(jobExecutionId, jobInstance, |
325 | | - jobExecutionDao.getJobParameters(jobExecutionId)); |
326 | | - jobExecution.setStartTime( |
327 | | - rs.getTimestamp(20) == null ? null : rs.getTimestamp(20).toLocalDateTime()); |
328 | | - jobExecution |
329 | | - .setEndTime(rs.getTimestamp(21) == null ? null : rs.getTimestamp(21).toLocalDateTime()); |
330 | | - jobExecution.setStatus(BatchStatus.valueOf(rs.getString(22))); |
331 | | - jobExecution.setExitStatus(new ExitStatus(rs.getString(23), rs.getString(24))); |
332 | | - jobExecution.setCreateTime( |
333 | | - rs.getTimestamp(25) == null ? null : rs.getTimestamp(25).toLocalDateTime()); |
334 | | - jobExecution.setLastUpdated( |
335 | | - rs.getTimestamp(26) == null ? null : rs.getTimestamp(26).toLocalDateTime()); |
336 | | - jobExecution.setVersion(rs.getInt(27)); |
337 | | - return new StepExecutionRowMapper(jobExecution).mapRow(rs, 0); |
| 321 | + return new StepExecutionRowMapper( |
| 322 | + jobExecutionDao.getJobExecution(rs.getLong("JOB_EXECUTION_ID"))) |
| 323 | + .mapRow(rs, 0); |
338 | 324 | } |
339 | 325 | return null; |
340 | 326 | } |
|
0 commit comments