public class SqlRowSetResultSetExtractor extends Object implements ResultSetExtractor<SqlRowSet>
ResultSetExtractor implementation that returns a Spring SqlRowSet
representation for each given ResultSet.
The default implementation uses a standard JDBC CachedRowSet underneath.
newCachedRowSet(),
SqlRowSet,
JdbcTemplate.queryForRowSet(String),
CachedRowSet| Constructor and Description |
|---|
SqlRowSetResultSetExtractor() |
| Modifier and Type | Method and Description |
|---|---|
protected SqlRowSet |
createSqlRowSet(ResultSet rs)
|
SqlRowSet |
extractData(ResultSet rs)
Implementations must implement this method to process the entire ResultSet.
|
protected CachedRowSet |
newCachedRowSet()
Create a new
CachedRowSet instance, to be populated by
the createSqlRowSet implementation. |
public SqlRowSet extractData(ResultSet rs) throws SQLException
ResultSetExtractorextractData in interface ResultSetExtractor<SqlRowSet>rs - ResultSet to extract data from. Implementations should
not close this: it will be closed by the calling JdbcTemplate.null if none
(the extractor will typically be stateful in the latter case).SQLException - if a SQLException is encountered getting column
values or navigating (that is, there's no need to catch SQLException)protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException
SqlRowSet that wraps the given ResultSet,
representing its data in a disconnected fashion.
This implementation creates a Spring ResultSetWrappingSqlRowSet
instance that wraps a standard JDBC CachedRowSet instance.
Can be overridden to use a different implementation.
rs - the original ResultSet (connected)SQLException - if thrown by JDBC methodsnewCachedRowSet(),
ResultSetWrappingSqlRowSetprotected CachedRowSet newCachedRowSet() throws SQLException
CachedRowSet instance, to be populated by
the createSqlRowSet implementation.
The default implementation uses JDBC 4.1's RowSetFactory.
SQLException - if thrown by JDBC methodscreateSqlRowSet(java.sql.ResultSet),
RowSetProvider.newFactory(),
RowSetFactory.createCachedRowSet()