站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 1.2.9 API 文档英文版

RowCallbackHandler (Spring Framework) - Spring Framework 1.2.9 API 文档英文版


org.springframework.jdbc.core
Interface RowCallbackHandler

All Known Subinterfaces:
ResultReader
All Known Implementing Classes:
MappingSqlQueryWithParameters.ResultReaderImpl, RowCountCallbackHandler, RowMapperResultReader, UpdatableSqlQuery.ResultReaderImpl

public interface RowCallbackHandler

An interface used by JdbcTemplate 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.

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.

The ResultReader subinterface allows to make a results List available in a uniform manner. JdbcTemplate's query methods will return the results List in that case, else returning null (indicating that result state is solely available from the RowCallbackHandler object).

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:
JdbcTemplate, RowMapper, ResultSetExtractor, RowCountCallbackHandler

Method Summary
 void processRow(ResultSet rs)
          Implementations must implement this method to process each row of data in the ResultSet.
 

Method Detail

processRow

void processRow(ResultSet rs)
                throws SQLException
Implementations must implement this method to process each row of data in the ResultSet. This method should not call 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.

Parameters:
rs - the ResultSet to process (pre-initialized for the current row)
Throws:
SQLException - if a SQLException is encountered getting column values (that is, there's no need to catch SQLException)


Copyright (c) 2002-2007 The Spring Framework Project.