May 19
Quick Tip: JDBC ParameterizedSingleColumnRowMapper in Spring 2.5.2+
This simple change in Spring 2.5.2 and above lets you remove boilerplate code that you have probably written for simple JDBC queries performed with the generics-aware SimpleJdbcTemplate (read my earlier 5 Minute Guide to… if you don’t know what this is). Change this:
new ParameterizedRowMapper<String>() { @Override public String mapRow(ResultSet rs, int rowNum) throws SQLException { return rs.getString("State"); } }
Into this:
new ParameterizedSingleColumnRowMapper<String>()
The fully qualified class name is org.springframework.jdbc.core.simple.ParameterizedSingleColumnRowMapper. Neat! If you’re interested in where this came from, you can have a look at the JIRA issue SPR-4320.



