org.springframework.batch.core.repository.dao
Class JdbcJobInstanceDao
java.lang.Object
org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
org.springframework.batch.core.repository.dao.JdbcJobInstanceDao
- All Implemented Interfaces:
- JobInstanceDao, InitializingBean
public class JdbcJobInstanceDao
- extends AbstractJdbcBatchMetadataDao
- implements JobInstanceDao, InitializingBean
Jdbc implementation of JobInstanceDao. Uses sequences (via Spring's
DataFieldMaxValueIncrementer abstraction) to create all primary keys
before inserting a new row. Objects are checked to ensure all mandatory
fields to be stored are not null. If any are found to be null, an
IllegalArgumentException will be thrown. This could be left to JdbcTemplate,
however, the exception will be fairly vague, and fails to highlight which
field caused the exception.
- Author:
- Lucas Ward, Dave Syer, Robert Kasanicky
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JdbcJobInstanceDao
public JdbcJobInstanceDao()
createJobInstance
public JobInstance createJobInstance(Job job,
JobParameters jobParameters)
- In this jdbc implementation a job id is obtained by asking the
jobIncrementer (which is likely a sequence) for the nextLong, and then
passing the Id and parameter values into an INSERT statement.
- Specified by:
createJobInstance in interface JobInstanceDao
- Returns:
- JobInstance
- Throws:
IllegalArgumentException - if any JobParameters fields are
null.- See Also:
JobInstanceDao.createJobInstance(Job, JobParameters)
getJobInstance
public JobInstance getJobInstance(Job job,
JobParameters jobParameters)
- The job table is queried for any jobs that match the
given identifier, adding them to a list via the RowMapper callback.
- Specified by:
getJobInstance in interface JobInstanceDao
- Returns:
JobInstance object matching
Job and JobParameters
- Throws:
IllegalArgumentException - if any JobParameters fields are
null.- See Also:
JobInstanceDao.getJobInstance(Job, JobParameters)
setJobIncrementer
public void setJobIncrementer(DataFieldMaxValueIncrementer jobIncrementer)
- Setter for
DataFieldMaxValueIncrementer to be used when
generating primary keys for JobInstance instances.
- Parameters:
jobIncrementer - the DataFieldMaxValueIncrementer
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet in interface InitializingBean- Overrides:
afterPropertiesSet in class AbstractJdbcBatchMetadataDao
- Throws:
Exception
Copyright © 2008 SpringSource. All Rights Reserved.