The Spring Framework

org.springframework.jdbc.core
Interface ResultSetExtractor

All Known Implementing Classes:
AbstractLobStreamingResultSetExtractor, RowMapperResultSetExtractor, SqlRowSetResultSetExtractor

public interface ResultSetExtractor

Callback interface used by JdbcTemplate's query methods. Implementations of this interface perform the actual work of extracting results, but don't need to worry about exception handling. SQLExceptions will be caught and handled correctly by the JdbcTemplate class.

This interface is mainly used within the JDBC framework. A RowCallbackHandler is usually a simpler choice for ResultSet processing, in particular a RowMapperResultSetExtractor in combination with a RowMapper.

Note: In contrast to a RowCallbackHandler, a ResultSetExtractor object is typically stateless and thus reusable, as long as it doesn't access stateful resources (like output streams when streaming LOB contents) or keep result state within the object.

Since:
April 24, 2003
Author:
Rod Johnson
See Also:
JdbcTemplate, RowCallbackHandler, RowMapperResultSetExtractor, AbstractLobStreamingResultSetExtractor

Method Summary
 Object extractData(ResultSet rs)
          Implementations must implement this method to process all rows in the ResultSet.
 

Method Detail

extractData

Object extractData(ResultSet rs)
                   throws SQLException,
                          DataAccessException
Implementations must implement this method to process all rows in the ResultSet.

Parameters:
rs - ResultSet to extract data from. Implementations should not close this: it will be closed by the JdbcTemplate.
Returns:
an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
Throws:
SQLException - if a SQLException is encountered getting column values or navigating (that is, there's no need to catch SQLException)
DataAccessException - in case of custom exceptions

The Spring Framework

Copyright © 2002-2006 The Spring Framework.