diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java index 14c4a26fa..b34189bd5 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java @@ -13,7 +13,6 @@ import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.repository.NoSuchBatchDomainObjectException; import org.springframework.batch.repeat.ExitStatus; import org.springframework.beans.factory.InitializingBean; -import org.springframework.dao.IncorrectResultSizeDataAccessException; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; import org.springframework.util.Assert; @@ -51,9 +50,6 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements private static final String FIND_JOB_EXECUTIONS = "SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%JOB_EXECUTION" + " where JOB_INSTANCE_ID = ?"; - private static final String GET_JOB_EXECUTION = "SELECT JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, CONTINUABLE, EXIT_CODE, EXIT_MESSAGE from %PREFIX%JOB_EXECUTION" - + " where JOB_EXECUTION_ID = ?"; - private DataFieldMaxValueIncrementer jobExecutionIncrementer; public List findJobExecutions(final JobInstance job) { @@ -65,28 +61,6 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements new Object[] { job.getId() }, new JobExecutionRowMapper(job)); } - public JobExecution getJobExecution(Long jobExecutionId) { - - Assert.notNull(jobExecutionId, "Job Execution id must not be null."); - - List executions = getJdbcTemplate().query(getQuery(GET_JOB_EXECUTION), - new Object[] { jobExecutionId }, new JobExecutionRowMapper(null)); - - JobExecution jobExecution; - if (executions.size() == 1) { - jobExecution = (JobExecution) executions.get(0); - } - else if (executions.size() == 0) { - jobExecution = null; - } - else { - throw new IncorrectResultSizeDataAccessException("Only one JobExecution may exist for given id: [" - + jobExecutionId + "]", 1, executions.size()); - } - - return jobExecution; - } - /** * @see JobDao#getJobExecutionCount(JobInstance) * @throws IllegalArgumentException if jobId is null. diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java index c7e0aadfd..a84825f94 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java @@ -49,18 +49,4 @@ public interface JobExecutionDao { */ List findJobExecutions(JobInstance jobInstance); - /** - * Given an id, return the matching JobExecution. - * - * @param jobExecutionId - id of the execution to be returned. - * @return {@link JobExecution} matching the id. - * @throws {@link IncorrectResultSizeDataAccessException} if more than one - * execution is found for the given id. - */ - JobExecution getJobExecution(Long jobExecutionId); - -// /** -// * @return return the last execution for the given instance -// */ -// JobExecution getLastJobExecution(JobInstance jobInstance); } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java index ec2abc3fb..f61e3ca1f 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java @@ -152,19 +152,6 @@ public abstract class AbstractJobDaoTests extends assertEquals(0, jobs.size()); } - - public void testGetJobExecution(){ - - JobExecution tempExecution = jobExecutionDao.getJobExecution(jobExecution.getId()); - assertEquals(jobExecution, tempExecution); - } - - public void testJobInstanceLastExecution(){ - //ensure the last execution id is being stored - JobExecution lastJobExecution = jobExecutionDao.getJobExecution(jobInstance.getLastExecution().getId()); - assertEquals(lastJobExecution, jobExecution); - } - public void testUpdateJobExecution() {