Skip to content

Commit

Permalink
Document that RowCallbackHandler can be used w/ NamedParameterJdbcTem…
Browse files Browse the repository at this point in the history
…plate

Closes spring-projectsgh-30705
  • Loading branch information
sbrannen authored and mdeinum committed Jun 29, 2023
1 parent 964d92d commit 3252726
Showing 1 changed file with 15 additions and 11 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,15 +20,17 @@
import java.sql.SQLException;

/**
* An interface used by {@link JdbcTemplate} for processing rows of a
* An interface used by {@link JdbcTemplate} and
* {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
* NamedParameterJdbcTemplate} for processing rows of a
* {@link java.sql.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.
* {@link java.sql.SQLException SQLExceptions} will be caught and handled
* by the calling JdbcTemplate.
* by the calling {@code JdbcTemplate} or {@code NamedParameterJdbcTemplate}.
*
* <p>In contrast to a {@link ResultSetExtractor}, a RowCallbackHandler
* object is typically stateful: It keeps the result state within the
* <p>In contrast to a {@link ResultSetExtractor}, a {@code RowCallbackHandler}
* object is typically stateful: it keeps the result state within the
* object, to be available for later inspection. See
* {@link RowCountCallbackHandler} for a usage example.
*
Expand All @@ -38,6 +40,7 @@
* @author Rod Johnson
* @author Juergen Hoeller
* @see JdbcTemplate
* @see org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate NamedParameterJdbcTemplate
* @see RowMapper
* @see ResultSetExtractor
* @see RowCountCallbackHandler
Expand All @@ -47,14 +50,15 @@ public interface RowCallbackHandler {

/**
* Implementations must implement this method to process each row of data
* in the ResultSet. This method should not call {@code next()} on
* the ResultSet; it is only supposed to extract values of the current row.
* in the {@link ResultSet}. This method should not call {@code next()} on
* the {@code ResultSet}; it is only supposed to extract values of the current
* row.
* <p>Exactly what the implementation chooses to do is up to it:
* A trivial implementation might simply count rows, while another
* a trivial implementation might simply count rows, while another
* implementation might build an XML document.
* @param rs the ResultSet to process (pre-initialized for the current row)
* @throws SQLException if an SQLException is encountered getting
* column values (that is, there's no need to catch SQLException)
* @param rs the {@code ResultSet} to process (pre-initialized for the current row)
* @throws SQLException if an {@code SQLException} is encountered getting
* column values (that is, there's no need to catch {@code SQLException})
*/
void processRow(ResultSet rs) throws SQLException;

Expand Down

0 comments on commit 3252726

Please sign in to comment.