public class

SqlRowSetResultSetExtractor

extends Object
implements ResultSetExtractor<T>
java.lang.Object
   ↳ org.springframework.jdbc.core.SqlRowSetResultSetExtractor

Class Overview

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

The default implementation uses a standard JDBC CachedRowSet underneath. This means that JDBC RowSet support needs to be available at runtime: by default, Sun's com.sun.rowset.CachedRowSetImpl class.

See Also

Summary

Public Constructors
SqlRowSetResultSetExtractor()
Public Methods
SqlRowSet extractData(ResultSet rs)
Implementations must implement this method to process the entire ResultSet.
Protected Methods
SqlRowSet createSqlRowSet(ResultSet rs)
Create a SqlRowSet that wraps the given ResultSet, representing its data in a disconnected fashion.
CachedRowSet newCachedRowSet()
Create a new CachedRowSet instance, to be populated by the createSqlRowSet implementation.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.jdbc.core.ResultSetExtractor

Public Constructors

public SqlRowSetResultSetExtractor ()

Public Methods

public SqlRowSet extractData (ResultSet rs)

Implementations must implement this method to process the entire ResultSet.

Parameters
rs ResultSet to extract data from. Implementations should not close this: it will be closed by the calling JdbcTemplate.
Returns
  • an arbitrary result object, or null if none (the extractor will typically be stateful in the latter case).
Throws
SQLException

Protected Methods

protected SqlRowSet createSqlRowSet (ResultSet rs)

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 the original ResultSet (connected)
Returns
  • the disconnected SqlRowSet
Throws
SQLException if thrown by JDBC methods

protected CachedRowSet newCachedRowSet ()

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

The default implementation creates a new instance of Sun's com.sun.rowset.CachedRowSetImpl class.

Returns
  • a new CachedRowSet instance
Throws
SQLException if thrown by JDBC methods
See Also