Spring provides three callback interfaces for JDBC as follows:
- Implementing RowMapper: Spring provides a RowMapper interface for mapping a single row of a ResultSet to an object. It can be used for both single and multiple row queries. It is parameterized as of Spring 3.0:
public interface RowMapper<T> { T mapRow(ResultSet rs, int rowNum) throws SQLException; }
- Let's understand this with the help of an example.