use of org.springframework.jdbc.core.RowMapperResultSetExtractor in project spring-integration by spring-projects.
the class JdbcPollingChannelAdapter method doPoll.
protected List<?> doPoll(SqlParameterSource sqlQueryParameterSource) {
final RowMapper<?> rowMapper = this.rowMapper == null ? new ColumnMapRowMapper() : this.rowMapper;
ResultSetExtractor<List<Object>> resultSetExtractor;
if (this.maxRowsPerPoll > 0) {
resultSetExtractor = rs -> {
List<Object> results = new ArrayList<Object>(JdbcPollingChannelAdapter.this.maxRowsPerPoll);
int rowNum = 0;
while (rs.next() && rowNum < JdbcPollingChannelAdapter.this.maxRowsPerPoll) {
results.add(rowMapper.mapRow(rs, rowNum++));
}
return results;
};
} else {
@SuppressWarnings("unchecked") ResultSetExtractor<List<Object>> temp = new RowMapperResultSetExtractor<Object>((RowMapper<Object>) rowMapper);
resultSetExtractor = temp;
}
if (sqlQueryParameterSource != null) {
return this.jdbcOperations.query(this.selectQuery, sqlQueryParameterSource, resultSetExtractor);
} else {
return this.jdbcOperations.getJdbcOperations().query(this.selectQuery, resultSetExtractor);
}
}
Aggregations