Java Code Examples for org.springframework.batch.item.database.JdbcCursorItemReader#setMaxRows()

The following examples show how to use org.springframework.batch.item.database.JdbcCursorItemReader#setMaxRows() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Bean
public JdbcCursorItemReader<BatchTaskAddress> addressReader(final DataSource dataSource,
                                                            final BatchTaskAddressMapper batchTaskAddressMapper) throws Exception {
    final JdbcCursorItemReader<BatchTaskAddress> reader = new JdbcCursorItemReader<>();
    reader.setSql(SELECT_ADDRESS_QUERY);
    reader.setRowMapper(batchTaskAddressMapper);
    reader.setDataSource(dataSource);
    reader.setMaxRows(100);
    reader.afterPropertiesSet();
    return reader;
}
 
Example 2
@Bean
public JdbcCursorItemReader<Long> addressPrinterReader(final DataSource dataSource) throws Exception {
    final JdbcCursorItemReader<Long> reader = new JdbcCursorItemReader<>();
    reader.setSql(SELECT_ADDRESS_QUERY);
    reader.setRowMapper(new SingleColumnRowMapper<>());
    reader.setDataSource(dataSource);
    reader.setMaxRows(100);
    reader.afterPropertiesSet();
    return reader;
}
 
Example 3
@Bean
public JdbcCursorItemReader<Long> addressBatchTaskDeletionReader(final DataSource dataSource) throws Exception {
    final JdbcCursorItemReader<Long> reader = new JdbcCursorItemReader<>();
    reader.setSql(SELECT_BATCH_TASK_ADDRESS_TO_DELETE_QUERY);
    reader.setRowMapper(new SingleColumnRowMapper<>());
    reader.setDataSource(dataSource);
    reader.setMaxRows(50);
    reader.afterPropertiesSet();
    return reader;
}