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..

About the Author

has written 22 posts on this blog.

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

Copyright © 2013 JDBC Tutorial. All rights reserved.
Proudly powered by WordPress. Developed by 7tech Solutions