|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.ExecutionContextUserSupport org.springframework.batch.item.database.support.MultipleColumnJdbcKeyCollector
public class MultipleColumnJdbcKeyCollector
JDBC implementation of the KeyCollector
interface that works for
composite keys. (i.e. keys represented by multiple columns) A SQL query to be
used to return the keys and a ItemPreparedStatementSetter
to map each
row in the result set to an Object must be set in order to work correctly.
DrivingQueryItemReader
,
ItemPreparedStatementSetter
Constructor Summary | |
---|---|
MultipleColumnJdbcKeyCollector()
|
|
MultipleColumnJdbcKeyCollector(JdbcTemplate jdbcTemplate,
String sql)
Construct a new ItemReader. |
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
List |
retrieveKeys(ExecutionContext executionContext)
Retrieve the keys to be iterated over. |
void |
setJdbcTemplate(JdbcTemplate jdbcTemplate)
|
void |
setKeyMapper(RowMapper keyMapper)
Set the RowMapper to be used to map a result set
to keys. |
void |
setPreparedStatementSetter(ItemPreparedStatementSetter preparedStatementSetter)
|
void |
setRestartSql(String restartQuery)
Set the query to use to retrieve keys in order to restore the previous state for restart. |
void |
setSql(String sql)
Set the sql statement used to generate the keys list. |
void |
updateContext(Object key,
ExecutionContext executionContext)
Given the provided key, store it in the provided ExecutionContext. |
Methods inherited from class org.springframework.batch.item.ExecutionContextUserSupport |
---|
getKey, setName |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MultipleColumnJdbcKeyCollector()
public MultipleColumnJdbcKeyCollector(JdbcTemplate jdbcTemplate, String sql)
jdbcTemplate
- sql
- - SQL statement that returns all keys to process.
object.Method Detail |
---|
public List retrieveKeys(ExecutionContext executionContext)
KeyCollector
Retrieve the keys to be iterated over. If the ExecutionContext provided includes any state relevant to this collector (because it was stored as part of saveState()) then it should start from the point indicated by that state.
In the case of a restart, (i.e. the ExecutionContext contains relevant state) this method should return only the keys that are remaining to be processed. For example, if the are 1,000 keys, and the 500th is processed before the batch job terminates unexpectedly, upon restart keys 501 through 1,000 should be returned.
retrieveKeys
in interface KeyCollector
executionContext
- ExecutionContext containing any potential initial state
that could potentially be used to retrieve the correct keys.
public void updateContext(Object key, ExecutionContext executionContext)
KeyCollector
DrivingQueryItemReader
doing it
for all KeyCollector implementations.
updateContext
in interface KeyCollector
key
- to be converted to restart data.public void setRestartSql(String restartQuery)
restartQuery
- public void afterPropertiesSet() throws Exception
Exception
public void setKeyMapper(RowMapper keyMapper)
RowMapper
to be used to map a result set
to keys.
keyMapper
- public void setSql(String sql)
sql
- public void setJdbcTemplate(JdbcTemplate jdbcTemplate)
public void setPreparedStatementSetter(ItemPreparedStatementSetter preparedStatementSetter)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |