org.springframework.batch.core.repository.dao
Class JdbcStepExecutionDao

java.lang.Object
  extended by org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
      extended by org.springframework.batch.core.repository.dao.JdbcStepExecutionDao
All Implemented Interfaces:
StepExecutionDao, InitializingBean

public class JdbcStepExecutionDao
extends AbstractJdbcBatchMetadataDao
implements StepExecutionDao, InitializingBean

Jdbc implementation of 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
See Also:
StepExecutionDao

Nested Class Summary
static class JdbcStepExecutionDao.AttributeType
           
 
Field Summary
 
Fields inherited from class org.springframework.batch.core.repository.dao.AbstractJdbcBatchMetadataDao
DEFAULT_TABLE_PREFIX
 
Constructor Summary
JdbcStepExecutionDao()
           
 
Method Summary
 void afterPropertiesSet()
           
 ExecutionContext findExecutionContext(StepExecution stepExecution)
          Find all ExecutionContext for the given StepExecution.
 StepExecution getStepExecution(JobExecution jobExecution, Step step)
           
 void saveOrUpdateExecutionContext(StepExecution stepExecution)
          Save or update execution attributes.
 void saveStepExecution(StepExecution stepExecution)
          Save a StepExecution.
 void setLobHandler(LobHandler lobHandler)
           
 void setStepExecutionIncrementer(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
getJdbcTemplate, getQuery, setJdbcTemplate, setTablePrefix
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcStepExecutionDao

public JdbcStepExecutionDao()
Method Detail

findExecutionContext

public ExecutionContext findExecutionContext(StepExecution stepExecution)
Description copied from interface: StepExecutionDao
Find all ExecutionContext for the given StepExecution.

Specified by:
findExecutionContext in interface StepExecutionDao

saveStepExecution

public void saveStepExecution(StepExecution stepExecution)
Save a StepExecution. A unique id will be generated by the stepExecutionIncrementor, and then set in the StepExecution. All values will then be stored via an INSERT statement.

Specified by:
saveStepExecution in interface StepExecutionDao
See Also:
StepExecutionDao.saveStepExecution(StepExecution)

saveOrUpdateExecutionContext

public void saveOrUpdateExecutionContext(StepExecution stepExecution)
Save or update execution attributes. A lob creator must be used, since any attributes that don't match a provided type must be serialized into a blob.

Specified by:
saveOrUpdateExecutionContext in interface StepExecutionDao
Parameters:
stepExecution - the StepExecution containing the ExecutionContext to be saved.
See Also:
LobCreator

updateStepExecution

public void updateStepExecution(StepExecution stepExecution)
Description copied from interface: StepExecutionDao
Update the given StepExecution Preconditions: Id must not be null.

Specified by:
updateStepExecution in interface StepExecutionDao

setLobHandler

public void setLobHandler(LobHandler lobHandler)

setStepExecutionIncrementer

public void setStepExecutionIncrementer(DataFieldMaxValueIncrementer stepExecutionIncrementer)

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class AbstractJdbcBatchMetadataDao
Throws:
Exception

getStepExecution

public StepExecution getStepExecution(JobExecution jobExecution,
                                      Step step)
Specified by:
getStepExecution in interface StepExecutionDao


Copyright © 2008 SpringSource. All Rights Reserved.