public interface RowCallbackHandler
JdbcTemplate
for processing rows of a
<code>ResultSet</code> on a per-row basis. Implementations of
this interface perform the actual work of processing each row
but don't need to worry about exception handling.
<code>SQLExceptions</code> will be caught and handled
by the calling JdbcTemplate.
In contrast to a ResultSetExtractor
, a RowCallbackHandler
object is typically stateful: It keeps the result state within the
object, to be available for later inspection. See
RowCountCallbackHandler
for a usage example.
Consider using a RowMapper
instead if you need to map
exactly one result object per row, assembling them into a List.
JdbcTemplate
,
RowMapper
,
ResultSetExtractor
,
RowCountCallbackHandler
Modifier and Type | Method and Description |
---|---|
void |
processRow(java.sql.ResultSet rs)
Implementations must implement this method to process each row of data
in the ResultSet.
|
void processRow(java.sql.ResultSet rs) throws java.sql.SQLException
next()
on
the ResultSet; it is only supposed to extract values of the current row.
Exactly what the implementation chooses to do is up to it: A trivial implementation might simply count rows, while another implementation might build an XML document.
rs
- the ResultSet to process (pre-initialized for the current row)java.sql.SQLException
- if a SQLException is encountered getting
column values (that is, there's no need to catch SQLException)