简体   繁体   English

JDBC / Spring-执行SQL查询以获取结果的迭代器

[英]JDBC/Spring - execute sql query to get iterator of results

So far I have been using 'SimpleJdbcTemplate' and used a 'RowCallbackHadler' to process the whole result of the query. 到目前为止,我一直在使用'SimpleJdbcTemplate'并使用'RowCallbackHadler'处理查询的整个结果。 At the moment I would like to receive an iterator-like object, which I could query for the next table row whe interested. 目前,我希望收到一个类似迭代器的对象,可以查询感兴趣的下一个表行。 Is the following behaviour possible in Spring/jdbc (preferrably slpring)? 在Spring / jdbc中是否可能发生以下行为(最好是slpring)?

You can use a ResultSetExtractor instead of a RowCallbackHadler . 您可以使用ResultSetExtractor代替RowCallbackHadler Methods in JdbcTemplate accepting the latter will accept the former too. JdbcTemplate接受后者的方法也将接受前者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM