Package org.springframework.jdbc.core
Class SqlRowSetResultSetExtractor
java.lang.Object
org.springframework.jdbc.core.SqlRowSetResultSetExtractor
- All Implemented Interfaces:
ResultSetExtractor<SqlRowSet>
ResultSetExtractor implementation that returns a Spring SqlRowSet
representation for each given ResultSet.
The default implementation uses a standard JDBC CachedRowSet underneath.
- Since:
- 1.2
- Author:
- Juergen Hoeller
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected SqlRowSetextractData(ResultSet rs) Implementations must implement this method to process the entire ResultSet.protected CachedRowSetCreate a newCachedRowSetinstance, to be populated by thecreateSqlRowSetimplementation.
-
Constructor Details
-
SqlRowSetResultSetExtractor
public SqlRowSetResultSetExtractor()
-
-
Method Details
-
extractData
Description copied from interface:ResultSetExtractorImplementations must implement this method to process the entire ResultSet.- Specified by:
extractDatain interfaceResultSetExtractor<SqlRowSet>- Parameters:
rs- the ResultSet to extract data from. Implementations should not close this: it will be closed by the calling JdbcTemplate.- Returns:
- an arbitrary result object, or
nullif none (the extractor will typically be stateful in the latter case). - Throws:
SQLException- if an SQLException is encountered getting column values or navigating (that is, there's no need to catch SQLException)
-
createSqlRowSet
Create aSqlRowSetthat wraps the givenResultSet, representing its data in a disconnected fashion.This implementation creates a Spring
ResultSetWrappingSqlRowSetinstance that wraps a standard JDBCCachedRowSetinstance. Can be overridden to use a different implementation.- Parameters:
rs- the original ResultSet (connected)- Returns:
- the disconnected SqlRowSet
- Throws:
SQLException- if thrown by JDBC methods- See Also:
-
newCachedRowSet
Create a newCachedRowSetinstance, to be populated by thecreateSqlRowSetimplementation.The default implementation uses JDBC 4.1's
RowSetFactory.- Returns:
- a new CachedRowSet instance
- Throws:
SQLException- if thrown by JDBC methods- See Also:
-