Glenn Gilbert opened SPR-4965 and commented
Currently, the 'queryForObject' series there is not a method that includes a PreparedStatementSetter. There are options such as queryForObject(String,Object[],RowMapper), but it doesn't allow other features of accessing a preparedStatement. (ie ps.setMaxRows(n) etc)
the code would be:
<code>
/**
- Query given SQL to create a prepared statement from SQL and a
- PreparedStatementSetter implementation that knows how to bind values to the
- query, mapping a single result row to a Java object via a RowMapper.
@param sql SQL query to execute
@param pss object that knows how to set values on the prepared statement.
If this is null, the SQL will be assumed to contain no bind
parameters. Even if there are no bind parameters, this object may be
used to set fetch size and other performance options.
@param rowMapper object that will map one object per row
@return the single mapped object
@throws IncorrectResultSizeDataAccessException if the query does not return
exactly one row DataAccessException if the query fails
*/
public Object queryForObject(String sql, PreparedStatementSetter pss, RowMapper rowMapper) throws DataAccessException {
List results = getJdbcTemplate().query(sql, pss, rowMapper);
return DataAccessUtils.singleResult(results);
}
</code>
No further details from SPR-4965
Glenn Gilbert opened SPR-4965 and commented
Currently, the 'queryForObject' series there is not a method that includes a PreparedStatementSetter. There are options such as queryForObject(String,Object[],RowMapper), but it doesn't allow other features of accessing a preparedStatement. (ie ps.setMaxRows(n) etc)
the code would be:
<code>
/**
@paramsql SQL query to execute@parampss object that knows how to set values on the prepared statement.@paramrowMapper object that will map one object per row@returnthe single mapped object@throwsIncorrectResultSizeDataAccessException if the query does not return*/
public Object queryForObject(String sql, PreparedStatementSetter pss, RowMapper rowMapper) throws DataAccessException {
}
</code>
No further details from SPR-4965