79073235

Date: 2024-10-10 07:46:11
Score: 1.5
Natty:
Report link

This is an old question, but for anyone facing a similar issue, here's what the Spring JDBC documentation clarifies:

The query method actually comes in two versions:

public void query(String sql, RowCallbackHandler rch): The rch parameter is a callback that processes each row one at a time. You don't need to call rs.next() manually to move to the next row—Spring handles that for you.

public T query(String sql, ResultSetExtractor rse): The rse parameter is a callback that extracts all rows of results at once. In this case, you'd process the entire ResultSet.

If you're using a lambda expression for the second argument, the JDK may select one of these methods automatically, depending on whether you assign the query result to a variable or not.

Reasons:
  • Whitelisted phrase (-2): for anyone facing
  • Long answer (-0.5):
  • No code block (0.5):
  • Me too answer (2.5): facing a similar issue
  • Low reputation (1):
Posted by: Mengstab Ketemaw