Top Description Fields Constructors Methods
org.springframework.jdbc.core

public Class SqlRowSetResultSetExtractor

extends Object
implements ResultSetExtractor<SqlRowSet>
Class Inheritance
All Implemented Interfaces
org.springframework.jdbc.core.ResultSetExtractor
Imports
java.sql.ResultSet, .SQLException, javax.sql.rowset.CachedRowSet, .RowSetFactory, .RowSetProvider, org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet, .SqlRowSet

ResultSetExtractor implementation that returns a Spring SqlRowSet representation for each given ResultSet.

The default implementation uses a standard JDBC CachedRowSet underneath.

Author
Juergen Hoeller
Since
1.2
See Also
newCachedRowSet, org.springframework.jdbc.support.rowset.SqlRowSet, JdbcTemplate#queryForRowSet(String), javax.sql.rowset.CachedRowSet

Field Summary

Modifier and TypeField and Description
private static final RowSetFactory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected SqlRowSet

Returns:

the disconnected SqlRowSet
createSqlRowSet
(ResultSet
the original ResultSet (connected)
rs
)

Create a SqlRowSet that wraps the given ResultSet, representing its data in a disconnected fashion.

public SqlRowSet
extractData(ResultSet
the ResultSet to extract data from. Implementations should not close this: it will be closed by the calling JdbcTemplate.
rs
)

Implements org.springframework.jdbc.core.ResultSetExtractor.extractData.

Implementations must implement this method to process the entire ResultSet.
protected CachedRowSet

Returns:

a new CachedRowSet instance
newCachedRowSet
()

Create a new CachedRowSet instance, to be populated by the createSqlRowSet implementation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rowSetFactoryback to summary
private static final RowSetFactory rowSetFactory

Constructor Detail

SqlRowSetResultSetExtractorback to summary
public SqlRowSetResultSetExtractor()

Method Detail

createSqlRowSetback to summary
protected SqlRowSet createSqlRowSet(ResultSet rs) throws SQLException

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

Parameters
rs:ResultSet

the original ResultSet (connected)

Returns:SqlRowSet

the disconnected SqlRowSet

Exceptions
SQLException:
if thrown by JDBC methods
See Also
newCachedRowSet(), org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet
extractDataback to summary
public SqlRowSet extractData(ResultSet rs) throws SQLException

Implements org.springframework.jdbc.core.ResultSetExtractor.extractData.

Doc from org.springframework.jdbc.core.ResultSetExtractor.extractData.

Implementations must implement this method to process the entire ResultSet.

Parameters
rs:ResultSet

the ResultSet to extract data from. Implementations should not close this: it will be closed by the calling JdbcTemplate.

Returns:SqlRowSet

an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).

Annotations
@Override
Exceptions
SQLException:
if an SQLException is encountered getting column values or navigating (that is, there's no need to catch SQLException)
newCachedRowSetback to summary
protected CachedRowSet newCachedRowSet() throws SQLException

Create a new CachedRowSet instance, to be populated by the createSqlRowSet implementation.

The default implementation uses JDBC 4.1's RowSetFactory.

Returns:CachedRowSet

a new CachedRowSet instance

Exceptions
SQLException:
if thrown by JDBC methods
See Also
createSqlRowSet, RowSetProvider#newFactory(), RowSetFactory#createCachedRowSet()