diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java index 0c382e099..632bce611 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java @@ -76,7 +76,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement + "STATUS = ?, COMMIT_COUNT = ?, TASK_COUNT = ?, TASK_STATISTICS = ?, CONTINUABLE = ? , EXIT_CODE = ?, " + "EXIT_MESSAGE = ?, VERSION = ? where STEP_EXECUTION_ID = ? and VERSION = ?"; - private static final String GET_STEP_EXECUTION = "SELECT STEP_EXECUTION_ID, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT," + private static final String GET_STEP_EXECUTION = "SELECT STEP_EXECUTION_ID, STEP_NAME, START_TIME, END_TIME, STATUS, COMMIT_COUNT," + " TASK_COUNT, TASK_STATISTICS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%STEP_EXECUTION where STEP_NAME = ? and JOB_EXECUTION_ID = ?"; private static final int EXIT_MESSAGE_LENGTH = 250; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java index 6ad455173..34666fea3 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java @@ -96,8 +96,6 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour stepExecution.setStatus(BatchStatus.STARTED); stepExecution.setStartTime(new Date(System.currentTimeMillis())); stepExecutionDao.saveStepExecution(stepExecution); -// step1.setLastExecution(stepExecution); - //stepInstanceDao.updateStepInstance(step1); executionContext = new ExecutionContext(); executionContext.putString("1", "testString1"); @@ -217,15 +215,8 @@ public abstract class AbstractStepDaoTests extends AbstractTransactionalDataSour assertEquals(executionContext, attributes); } - public void testGetLastStepExecution() { - StepExecution lastExecution = new StepExecution(step1, jobExecution, null); - lastExecution.setStatus(BatchStatus.STARTED); - - int JUMP_INTO_FUTURE = 1000; // makes sure start time is 'greatest' - lastExecution.setStartTime(new Date(System.currentTimeMillis() + JUMP_INTO_FUTURE)); - stepExecutionDao.saveStepExecution(lastExecution); - -// assertEquals(lastExecution, stepExecutionDao.getLastStepExecution(step1, jobExecution)); + public void testGetStepExecution() { + assertEquals(stepExecution, stepExecutionDao.getStepExecution(jobExecution, step1)); } }