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.

  • ResultSetExtractor
  • RowCallbackHandler
  • RowMapper

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.

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