Package org.springframework.jdbc.core
Interface RowCallbackHandler
- All Known Implementing Classes:
RowCountCallbackHandler
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
An interface used by
JdbcTemplate
and
NamedParameterJdbcTemplate
for processing rows of a
ResultSet
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.
SQLExceptions
will be caught and handled
by the calling JdbcTemplate
or NamedParameterJdbcTemplate
.
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.
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
processRow
(ResultSet rs) Implementations must implement this method to process each row of data in theResultSet
.
-
Method Details
-
processRow
Implementations must implement this method to process each row of data in theResultSet
. This method should not callnext()
on theResultSet
; 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.
- Parameters:
rs
- theResultSet
to process (pre-initialized for the current row)- Throws:
SQLException
- if anSQLException
is encountered getting column values (that is, there's no need to catchSQLException
)
-