List of usage examples for org.springframework.jdbc.core JdbcOperations query
<T> List<T> query(String sql, RowMapper<T> rowMapper, @Nullable Object... args) throws DataAccessException;
From source file:org.danann.cernunnos.sql.QueryTask.java
public void perform(TaskRequest req, TaskResponse res) { final DataSource dataSource = DataSourceRetrievalUtil.getDataSource(dataSourcePhrase, connectionPhrase, req, res);//from w ww . j ava 2 s . c o m final SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource); final JdbcOperations jdbcOperations = jdbcTemplate.getJdbcOperations(); //Setup the parameter setter and row callback handler for this task and the request/response final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter( this.parameters, req, res); final ResponseMappingRowCallbackHandler rowCallbackHandler = new ResponseMappingRowCallbackHandler(this, req, res); //Get the SQL and run the query final String finalSql = (String) sql.evaluate(req, res); jdbcOperations.query(finalSql, preparedStatementSetter, rowCallbackHandler); if (rowCallbackHandler.getRowCount() == 0) { this.performSubtasks(req, res, this.emptyResult); } }