|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.core.SqlRowSetResultSetExtractor
public class SqlRowSetResultSetExtractor
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 is
used, which is part of JDK 1.5+ and also available separately as part of
Sun's JDBC RowSet Implementations download (rowset.jar).
newCachedRowSet()
,
SqlRowSet
,
JdbcTemplate.queryForRowSet(String)
,
CachedRowSet
Constructor Summary | |
---|---|
SqlRowSetResultSetExtractor()
|
Method Summary | |
---|---|
protected SqlRowSet |
createSqlRowSet(ResultSet rs)
Create a SqlRowSet that wraps the given ResultSet, representing its data in a disconnected fashion. |
Object |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SqlRowSetResultSetExtractor()
Method Detail |
---|
public Object extractData(ResultSet rs) throws SQLException
ResultSetExtractor
extractData
in interface ResultSetExtractor
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
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()
,
ResultSetWrappingSqlRowSet
protected CachedRowSet newCachedRowSet() throws SQLException
createSqlRowSet
implementation.
The default implementation creates a new instance of
Sun's com.sun.rowset.CachedRowSetImpl
class,
which is part of JDK 1.5+ and also available separately
as part of Sun's JDBC RowSet Implementations download.
SQLException
- if thrown by JDBC methodscreateSqlRowSet(java.sql.ResultSet)
,
CachedRowSetImpl
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |