diff --git a/execution/src/main/java/org/springframework/batch/execution/repository/dao/HibernateJobDao.java b/execution/src/main/java/org/springframework/batch/execution/repository/dao/HibernateJobDao.java index a6c127e41..38ed51d8d 100644 --- a/execution/src/main/java/org/springframework/batch/execution/repository/dao/HibernateJobDao.java +++ b/execution/src/main/java/org/springframework/batch/execution/repository/dao/HibernateJobDao.java @@ -98,7 +98,7 @@ public class HibernateJobDao extends HibernateDaoSupport implements JobDao { public Object doInHibernate(Session session) { return session .createQuery( - "select count(id) from JobExecution where jobId = :jobId") + "select count(id) from JobExecution where job.id = :jobId") .setLong("jobId", jobId.longValue()) .uniqueResult(); } diff --git a/execution/src/main/resources/org/springframework/batch/execution/repository/dao/JobExecution.hbm.xml b/execution/src/main/resources/org/springframework/batch/execution/repository/dao/JobExecution.hbm.xml index 71928d035..90b066021 100644 --- a/execution/src/main/resources/org/springframework/batch/execution/repository/dao/JobExecution.hbm.xml +++ b/execution/src/main/resources/org/springframework/batch/execution/repository/dao/JobExecution.hbm.xml @@ -12,7 +12,7 @@ &job-execution-generator; - + diff --git a/execution/src/main/resources/org/springframework/batch/execution/repository/dao/StepExecution.hbm.xml b/execution/src/main/resources/org/springframework/batch/execution/repository/dao/StepExecution.hbm.xml index 0c536cbd2..8c6ee24b4 100644 --- a/execution/src/main/resources/org/springframework/batch/execution/repository/dao/StepExecution.hbm.xml +++ b/execution/src/main/resources/org/springframework/batch/execution/repository/dao/StepExecution.hbm.xml @@ -13,7 +13,7 @@ - + diff --git a/execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java b/execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java index 1cd5a82e9..eb88ae2d0 100644 --- a/execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java +++ b/execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java @@ -80,7 +80,7 @@ public abstract class AbstractJobDaoTests extends // Create an execution jobExecutionStartTime = new Timestamp(System.currentTimeMillis()); - jobExecution = new JobExecution(new JobInstance(jobRuntimeInformation, job.getId())); + jobExecution = new JobExecution(job); jobExecution.setStartTime(jobExecutionStartTime); jobExecution.setStatus(BatchStatus.STARTED); jobDao.save(jobExecution);