Example usage for org.springframework.jdbc.core SingleColumnRowMapper newInstance

List of usage examples for org.springframework.jdbc.core SingleColumnRowMapper newInstance

Introduction

In this page you can find the example usage for org.springframework.jdbc.core SingleColumnRowMapper newInstance.

Prototype

public static <T> SingleColumnRowMapper<T> newInstance(Class<T> requiredType) 

Source Link

Document

Static factory method to create a new SingleColumnRowMapper (with the required type specified only once).

Usage

From source file:nu.yona.server.batch.jobs.ActivityAggregationBatchJob.java

private JdbcPagingItemReader<Long> createReader(Date cutOffDate, int chunkSize,
        SqlPagingQueryProviderFactoryBean sqlPagingQueryProviderFactoryBean) {
    try {/*  ww  w  . jav a  2 s. c o  m*/
        JdbcPagingItemReader<Long> reader = new JdbcPagingItemReader<>();
        reader.setQueryProvider(sqlPagingQueryProviderFactoryBean.getObject());
        reader.setDataSource(dataSource);
        reader.setPageSize(chunkSize);
        reader.setRowMapper(SingleColumnRowMapper.newInstance(Long.class));
        reader.setParameterValues(Collections.singletonMap("cutOffDate", cutOffDate));
        reader.afterPropertiesSet();
        reader.setSaveState(true);
        return reader;
    } catch (Exception e) {
        throw YonaException.unexpected(e);
    }
}