I'm using Spring's support for JDBC. I'd like to use [JdbcTemplate] (or SimpleJdbcTemplate) to execute a query and obtain the result as an instance of ResultSet.
The only way that I can see of achieving this is using:
String sql = "select * from....";
SqlRowSet results = jdbcTemplate.queryForRowSet(sql);
An obvious shortcoming of this approach is that it requires me to make an assumption (by casting) about the implementation type of SqlRowSet, but is there a better way?
The reason I want to obtain the results as a ResultSet, rather than a collection of beans, is because the results will be passed straight to a Jasper report for display. In other words, the Java bean would be used for nothing other than temporarily storing each row in the ResultSet, and I'd like to avoid creating such a bean for every Jasper report if possible.
以上就是getResultSet from Spring-JDBC的详细内容，更多请关注web前端其它相关文章！