Using RowCallbackHandler in Spring JdbcTemplate
CallbackHandler is a interface used by JdbcTemplate’s query methods. This interface cantains only one method with the signature in the following code snippet.
The implementation class of this interface needs to implements the processRow() method, which take responsibility to process each row of data in the ResultSet. The processRow() method should not call next() on the ResultSet. It requiredd to extract values of the current row and process the data on per-row basis.
Usually the processRow() method does not need to worry about handling the SQLException, the SQLException will be caught and handle by JdbcTemplate class calling this implementation.
Following code shows ProductResult class implementing RowCallbackHandler interface..