Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jdbc.core
Class SqlRowSetResultSetExtractor

    java.lang.Object
      org.springframework.jdbc.core.SqlRowSetResultSetExtractor

All Implemented Interfaces:
  ResultSetExtractor<SqlRowSet>

    public class SqlRowSetResultSetExtractor

extends java.lang.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. This means that JDBC RowSet support needs to be available at runtime: by default, Sun's `com.sun.rowset.CachedRowSetImpl` class on Java 5 and 6, or the `javax.sql.rowset.RowSetProvider` mechanism on Java 7 / JDBC 4.1.

Since:
  1.2
Author:
  Juergen Hoeller
See Also:
  `newCachedRowSet()`, `SqlRowSet`, `JdbcTemplate.queryForRowSet(String)`, `CachedRowSet`

Constructor Summary
`SqlRowSetResultSetExtractor()`

Method Summary
`protected SqlRowSet` | `createSqlRowSet(java.sql.ResultSet rs)` Create a SqlRowSet that wraps the given ResultSet, representing its data in a disconnected fashion.
`SqlRowSet` | `extractData(java.sql.ResultSet rs)` Implementations must implement this method to process the entire ResultSet.
`protected javax.sql.rowset.CachedRowSet` | `newCachedRowSet()` Create a new CachedRowSet instance, to be populated by the `createSqlRowSet` implementation.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SqlRowSetResultSetExtractor

    public SqlRowSetResultSetExtractor()

Method Detail

### extractData

    public SqlRowSet extractData(java.sql.ResultSet rs)
                          throws java.sql.SQLException

  Description copied from interface: `ResultSetExtractor`
  Implementations must implement this method to process the entire ResultSet.

  Specified by:
    `extractData` in interface `ResultSetExtractor<SqlRowSet>`
  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:
    `java.sql.SQLException` - if a SQLException is encountered getting column values or navigating (that is, there's no need to catch SQLException)

### createSqlRowSet

    protected SqlRowSet createSqlRowSet(java.sql.ResultSet rs)
                                 throws java.sql.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` - the original ResultSet (connected)
  Returns:
    the disconnected SqlRowSet
  Throws:
    `java.sql.SQLException` - if thrown by JDBC methods
  See Also:
    `newCachedRowSet()`, `ResultSetWrappingSqlRowSet`

### newCachedRowSet

    protected javax.sql.rowset.CachedRowSet newCachedRowSet()
                                                     throws java.sql.SQLException

  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:
    `java.sql.SQLException` - if thrown by JDBC methods
  See Also:
    `createSqlRowSet(java.sql.ResultSet)`, `CachedRowSetImpl`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD