到目前为止,我一直在使用“SimpleJdbcTemplate”并使用“RowCallbackHadler”来处理查询的整个结果。目前我想接收一个类似迭代器的对象,我可以查询感兴趣的下一个表行。在 Spring/jdbc(最好是 slpring)中是否可能出现以下行为?
最佳答案
您可以尝试使用 JdbcTemplate 方法 queryforRowSet
public SqlRowSet queryForRowSet(String sql,
Object... args)
throws DataAccessException
http://static.springsource.org/spring/docs/current/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.html#queryForRowSet%28java.lang.String,%20java.lang.Object...%29