|
As is, I do not think there is a way to call SimpleJdbcTemplate.query() with a SingleColumnRowMapper. These are the following methods:
SimpleJdbcTemplate.java: public <T> List<T> query(String sql, ParameterizedRowMapper<T> rm, Object... args) throws DataAccessException I can not call any of these methods with the SingleColumnRowMapper used for the row mapper. Is there another way to do what I want to do? Fair enough! I haven't thought of the SimpleJdbcTemplate signature issue there...
I guess we'll indeed have to provide a ParameterizedSingleColumnRowMapper subclass there... Even if the result might not be entirely satisfying either, since you'll have to specify the expected type twice - once for the parameterized type, once as constructor argument for the RowMapper impl... Juergen Juergen,
I actually followed the ParameterizedBeanPropertyRowMapper and that you only have to specify the type once. I'm attaching my implementation. Thanks for looking into this. I've added such a ParameterizedSingleColumnRowMapper for Spring 2.5.2, although in a slightly different fashion: It is implemented as a subclass of SingleColumnRowMapper now, in order to preserve the same public/protected methods.
I've made sure to make this analogous to BeanPropertyRowMapper, which I've revised to follow to exact same pattern now. Juergen |
|||||||||||||||||||||||||||||||||||||||||||||||||
Juergen