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, Minsoo Kim
- 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 TypeMethodDescriptionvoid
addStepExecutions
(JobExecution jobExecution) Retrieve all theStepExecution
for the parentJobExecution
.void
long
countStepExecutions
(JobInstance jobInstance, String stepName) Counts all theStepExecution
for a given step name.void
deleteStepExecution
(StepExecution stepExecution) Delete the given step execution.getLastStepExecution
(JobInstance jobInstance, String stepName) Retrieve the lastStepExecution
for a givenJobInstance
ordered by creation time and then id.getStepExecution
(JobExecution jobExecution, Long stepExecutionId) Retrieve aStepExecution
from its id.void
saveStepExecution
(StepExecution stepExecution) Save a StepExecution.void
saveStepExecutions
(Collection<StepExecution> stepExecutions) Batch insert StepExecutionsvoid
setExitMessageLength
(int exitMessageLength) Public setter for the exit message length in database.void
setStepExecutionIncrementer
(org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer stepExecutionIncrementer) void
updateStepExecution
(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:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Overrides:
afterPropertiesSet
in 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:
saveStepExecution
in interfaceStepExecutionDao
- Parameters:
stepExecution
-StepExecution
instance to be saved.- See Also:
-
saveStepExecutions
Batch insert StepExecutions- Specified by:
saveStepExecutions
in interfaceStepExecutionDao
- Parameters:
stepExecutions
- a collection ofJobExecution
instances to be saved.- See Also:
-
updateStepExecution
Description copied from interface:StepExecutionDao
Update the given StepExecution Preconditions: Id must not be null.- Specified by:
updateStepExecution
in interfaceStepExecutionDao
- Parameters:
stepExecution
-StepExecution
instance to be updated.
-
getStepExecution
Description copied from interface:StepExecutionDao
Retrieve aStepExecution
from its id.- Specified by:
getStepExecution
in interfaceStepExecutionDao
- Parameters:
jobExecution
- the parentJobExecution
stepExecutionId
- the step execution id- Returns:
- a
StepExecution
-
getLastStepExecution
Description copied from interface:StepExecutionDao
Retrieve the lastStepExecution
for a givenJobInstance
ordered by creation time and then id.- Specified by:
getLastStepExecution
in interfaceStepExecutionDao
- Parameters:
jobInstance
- the parentJobInstance
stepName
- the name of the step- Returns:
- a
StepExecution
-
addStepExecutions
Description copied from interface:StepExecutionDao
Retrieve all theStepExecution
for the parentJobExecution
.- Specified by:
addStepExecutions
in interfaceStepExecutionDao
- Parameters:
jobExecution
- the parent job execution
-
countStepExecutions
Description copied from interface:StepExecutionDao
Counts all theStepExecution
for a given step name.- Specified by:
countStepExecutions
in interfaceStepExecutionDao
- Parameters:
jobInstance
- the parentJobInstance
stepName
- the name of the step- Returns:
- the count of
StepExecution
s for a given step
-
deleteStepExecution
Delete the given step execution.- Specified by:
deleteStepExecution
in interfaceStepExecutionDao
- Parameters:
stepExecution
- the step execution to delete
-