类 JdbcJobInstanceDao
- java.lang.Object
- org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
- org.springframework.batch.core.repository.dao.JdbcJobInstanceDao
- 所有已实现的接口:
JobInstanceDao
,org.springframework.beans.factory.InitializingBean
public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements JobInstanceDao, org.springframework.beans.factory.InitializingBean
JDBC implementation ofJobInstanceDao
. Uses sequences (via Spring'sDataFieldMaxValueIncrementer
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.- 作者:
- Lucas Ward, Dave Syer, Robert Kasanicky, Michael Minella, Will Schipp, Mahmoud Ben Hassine
字段概要
从类继承的字段 org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX
构造器概要
构造器 构造器 说明 JdbcJobInstanceDao()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
JobInstance
createJobInstance(java.lang.String jobName, JobParameters jobParameters)
In this JDBC implementation a job id is obtained by asking the jobIncrementer (which is likely a sequence) for the next long value, and then passing the Id and parameter values into an INSERT statement.java.util.List<JobInstance>
findJobInstancesByName(java.lang.String jobName, int start, int count)
Fetch the last job instances with the provided name, sorted backwards by primary key, using a 'like' criteriaJobInstance
getJobInstance(java.lang.Long instanceId)
Fetch the job instance with the provided identifier.JobInstance
getJobInstance(java.lang.String jobName, JobParameters jobParameters)
The job table is queried for any jobs that match the given identifier, adding them to a list via the RowMapper callback.JobInstance
getJobInstance(JobExecution jobExecution)
Fetch the JobInstance for the provided JobExecution.int
getJobInstanceCount(java.lang.String jobName)
Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.java.util.List<JobInstance>
getJobInstances(java.lang.String jobName, int start, int count)
Fetch the last job instances with the provided name, sorted backwards by primary key.java.util.List<java.lang.String>
getJobNames()
Retrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed.void
setJobIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobIncrementer)
Setter forDataFieldMaxValueIncrementer
to be used when generating primary keys forJobInstance
instances.从类继承的方法 org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefix
构造器详细资料
JdbcJobInstanceDao
public JdbcJobInstanceDao()
方法详细资料
createJobInstance
public JobInstance createJobInstance(java.lang.String jobName, JobParameters jobParameters)
In this JDBC implementation a job id is obtained by asking the jobIncrementer (which is likely a sequence) for the next long value, and then passing the Id and parameter values into an INSERT statement.- 指定者:
createJobInstance
在接口中JobInstanceDao
- 参数:
jobName
-String
containing the name of the job.jobParameters
-JobParameters
containing the parameters for the JobInstance.- 返回:
- JobInstance
JobInstance
instance that was created. - 抛出:
java.lang.IllegalArgumentException
- if anyJobParameters
fields are null.- 另请参阅:
JobInstanceDao.createJobInstance(String, JobParameters)
getJobInstance
@Nullable public JobInstance getJobInstance(java.lang.String jobName, JobParameters jobParameters)
The job table is queried for any jobs that match the given identifier, adding them to a list via the RowMapper callback.- 指定者:
getJobInstance
在接口中JobInstanceDao
- 参数:
jobName
- the name of the jobjobParameters
- the parameters with which the job was executed- 返回:
JobInstance
object matching the job name andJobParameters
ornull
- 抛出:
java.lang.IllegalArgumentException
- if anyJobParameters
fields are null.- 另请参阅:
JobInstanceDao.getJobInstance(String, JobParameters)
getJobInstance
@Nullable public JobInstance getJobInstance(@Nullable java.lang.Long instanceId)
从接口复制的说明:JobInstanceDao
Fetch the job instance with the provided identifier.- 指定者:
getJobInstance
在接口中JobInstanceDao
- 参数:
instanceId
- the job identifier- 返回:
- the job instance with this identifier or
null
if it doesn't exist
getJobNames
public java.util.List<java.lang.String> getJobNames()
从接口复制的说明:JobInstanceDao
Retrieve the names of all job instances sorted alphabetically - i.e. jobs that have ever been executed.- 指定者:
getJobNames
在接口中JobInstanceDao
- 返回:
- the names of all job instances
getJobInstances
public java.util.List<JobInstance> getJobInstances(java.lang.String jobName, int start, int count)
从接口复制的说明:JobInstanceDao
Fetch the last job instances with the provided name, sorted backwards by primary key. if using the JdbcJobInstance, you can provide the jobName with a wildcard (e.g. *Job) to return 'like' job names. (e.g. *Job will return 'someJob' and 'otherJob')- 指定者:
getJobInstances
在接口中JobInstanceDao
- 参数:
jobName
- the job namestart
- the start index of the instances to returncount
- the maximum number of objects to return- 返回:
- the job instances with this name or empty if none
getJobInstance
@Nullable public JobInstance getJobInstance(JobExecution jobExecution)
从接口复制的说明:JobInstanceDao
Fetch the JobInstance for the provided JobExecution.- 指定者:
getJobInstance
在接口中JobInstanceDao
- 参数:
jobExecution
- the JobExecution- 返回:
- the JobInstance for the provided execution or
null
if it doesn't exist.
getJobInstanceCount
public int getJobInstanceCount(@Nullable java.lang.String jobName) throws NoSuchJobException
从接口复制的说明:JobInstanceDao
Query the repository for the number of uniqueJobInstance
s associated with the supplied job name.- 指定者:
getJobInstanceCount
在接口中JobInstanceDao
- 参数:
jobName
- the name of the job to query for- 返回:
- the number of
JobInstance
s that exist within the associated job repository - 抛出:
NoSuchJobException
- thrown if no Job has the jobName specified.
setJobIncrementer
public void setJobIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer jobIncrementer)
Setter forDataFieldMaxValueIncrementer
to be used when generating primary keys forJobInstance
instances.- 参数:
jobIncrementer
- theDataFieldMaxValueIncrementer
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 覆盖:
afterPropertiesSet
在类中AbstractJdbcBatchMetadataDao
- 抛出:
java.lang.Exception
findJobInstancesByName
public java.util.List<JobInstance> findJobInstancesByName(java.lang.String jobName, int start, int count)
从接口复制的说明:JobInstanceDao
Fetch the last job instances with the provided name, sorted backwards by primary key, using a 'like' criteria- 指定者:
findJobInstancesByName
在接口中JobInstanceDao
- 参数:
jobName
-String
containing the name of the job.start
- int containing the offset of where list of job instances results should begin.count
- int containing the number of job instances to return.- 返回:
- a list of
JobInstance
for the job name requested.