Class JdbcStepExecutionDao
java.lang.Object
org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
org.springframework.batch.core.repository.dao.JdbcStepExecutionDao
- All Implemented Interfaces:
StepExecutionDao,org.springframework.beans.factory.InitializingBean
public class JdbcStepExecutionDao
extends AbstractJdbcBatchMetadataDao
implements StepExecutionDao, org.springframework.beans.factory.InitializingBean
JDBC implementation of
Allows customization of the tables names used by Spring Batch for step meta data via a prefix property.
Uses sequences or tables (via Spring's
StepExecutionDao.Allows customization of the tables names used by Spring Batch for step meta data via a prefix property.
Uses sequences or tables (via Spring's
DataFieldMaxValueIncrementer
abstraction) to create all primary keys before inserting a new row. All
objects are checked to ensure all 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, David Turanski, Mahmoud Ben Hassine, Baris Cubukcuoglu
- See Also:
-
Field Summary
Fields inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
DEFAULT_EXIT_MESSAGE_LENGTH, DEFAULT_TABLE_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddStepExecutions(JobExecution jobExecution) Retrieve all theStepExecutionfor the parentJobExecution.voidintcountStepExecutions(JobInstance jobInstance, String stepName) Counts all theStepExecutionfor a given step name.getLastStepExecution(JobInstance jobInstance, String stepName) Retrieve the lastStepExecutionfor a givenJobInstanceordered by starting time and then id.getStepExecution(JobExecution jobExecution, Long stepExecutionId) Retrieve aStepExecutionfrom its id.voidsaveStepExecution(StepExecution stepExecution) Save a StepExecution.voidsaveStepExecutions(Collection<StepExecution> stepExecutions) Batch insert StepExecutionsvoidsetExitMessageLength(int exitMessageLength) Public setter for the exit message length in database.voidsetStepExecutionIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer stepExecutionIncrementer) voidupdateStepExecution(StepExecution stepExecution) Update the given StepExecution Preconditions: Id must not be null.Methods inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
getClobTypeToUse, getJdbcTemplate, getQuery, getTablePrefix, setClobTypeToUse, setJdbcTemplate, setTablePrefix
-
Constructor Details
-
JdbcStepExecutionDao
public JdbcStepExecutionDao()
-
-
Method Details
-
setExitMessageLength
public void setExitMessageLength(int exitMessageLength) Public setter for the exit message length in database. Do not set this if you haven't modified the schema.- Parameters:
exitMessageLength- the exitMessageLength to set
-
setStepExecutionIncrementer
public void setStepExecutionIncrementer(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer stepExecutionIncrementer) -
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classAbstractJdbcBatchMetadataDao- Throws:
Exception
-
saveStepExecution
Save a StepExecution. A unique id will be generated by the stepExecutionIncrementer, and then set in the StepExecution. All values will then be stored via an INSERT statement.- Specified by:
saveStepExecutionin interfaceStepExecutionDao- Parameters:
stepExecution-StepExecutioninstance to be saved.- See Also:
-
saveStepExecutions
Batch insert StepExecutions- Specified by:
saveStepExecutionsin interfaceStepExecutionDao- Parameters:
stepExecutions- a collection ofJobExecutioninstances to be saved.- See Also:
-
updateStepExecution
Description copied from interface:StepExecutionDaoUpdate the given StepExecution Preconditions: Id must not be null.- Specified by:
updateStepExecutionin interfaceStepExecutionDao- Parameters:
stepExecution-StepExecutioninstance to be updated.
-
getStepExecution
Description copied from interface:StepExecutionDaoRetrieve aStepExecutionfrom its id.- Specified by:
getStepExecutionin interfaceStepExecutionDao- Parameters:
jobExecution- the parentJobExecutionstepExecutionId- the step execution id- Returns:
- a
StepExecution
-
getLastStepExecution
Description copied from interface:StepExecutionDaoRetrieve the lastStepExecutionfor a givenJobInstanceordered by starting time and then id.- Specified by:
getLastStepExecutionin interfaceStepExecutionDao- Parameters:
jobInstance- the parentJobInstancestepName- the name of the step- Returns:
- a
StepExecution
-
addStepExecutions
Description copied from interface:StepExecutionDaoRetrieve all theStepExecutionfor the parentJobExecution.- Specified by:
addStepExecutionsin interfaceStepExecutionDao- Parameters:
jobExecution- the parent job execution
-
countStepExecutions
Description copied from interface:StepExecutionDaoCounts all theStepExecutionfor a given step name.- Specified by:
countStepExecutionsin interfaceStepExecutionDao- Parameters:
jobInstance- the parentJobInstancestepName- the name of the step- Returns:
- the count of
StepExecutions for a given step
-