Using ResultSetExcractor in Spring JdbcTemplate
JdbcTemplate class includes query methods to prepare and execute the SQL queries. The Spring JDBC abstraction framewor provides three different types of callbacks to read the results after executing the SQL query using query() methods.
Let’s start our discussion with ResultSetExtractor.
ResultSetExtractor contains only one method with the regnature shown in the following code snippet.
The implementation class of this interface need to implements the extractData() metod, which takes the responsibility of extracting results from a ResultSet, but it does not need to worry about handling SQLException raised while extracting the results.
The SQLException will be caught and handle by JdbcTemplate class calling this implementation.