Example usage for org.springframework.jdbc.core BeanPropertyRowMapper mapRow

List of usage examples for org.springframework.jdbc.core BeanPropertyRowMapper mapRow

Introduction

In this page you can find the example usage for org.springframework.jdbc.core BeanPropertyRowMapper mapRow.

Prototype

@Override
public T mapRow(ResultSet rs, int rowNumber) throws SQLException 

Source Link

Document

Extract the values for all columns in the current row.

Usage

From source file:org.easybatch.jdbc.spring.SpringJdbcRecordMapper.java

@Override
@SuppressWarnings(value = "unchecked")
public T mapRecord(Record record) throws Exception {
    ResultSet resultSet = (ResultSet) record.getPayload();
    BeanPropertyRowMapper beanPropertyRowMapper = new BeanPropertyRowMapper(type);
    return (T) beanPropertyRowMapper.mapRow(resultSet, record.getHeader().getNumber().intValue());
}

From source file:org.easybatch.extensions.spring.SpringJdbcRecordMapper.java

@Override
public GenericRecord<P> processRecord(JdbcRecord record) throws RecordMappingException {
    ResultSet resultSet = record.getPayload();
    BeanPropertyRowMapper<P> beanPropertyRowMapper = new BeanPropertyRowMapper<>(type);
    try {/* w  w  w  .  ja  v  a2  s  .c  om*/
        return new GenericRecord<>(record.getHeader(),
                beanPropertyRowMapper.mapRow(resultSet, record.getHeader().getNumber().intValue()));
    } catch (SQLException e) {
        throw new RecordMappingException("Unable to map record " + record + " to target type", e);
    }
}