I am using Spring support for JDBC. I would like to use JdbcTemplate (or SimpleJdbcTemplate) to execute the query and get the result as an instance of ResultSet.
The only way I can figure this out is to use:
String sql = "select * from...."; SqlRowSet results = jdbcTemplate.queryForRowSet(sql); ((ResultSetWrappingSqlRowSet) results).getResultSet();
The obvious drawback of this approach is that it requires me to make an assumption (by casting) about the type of implementation of SqlRowSet, but is there a better way?
Background information ...
The reason I want to get the results as a ResultSet, rather than a beans set, is because the results will be passed directly to the Jasper report for display. In other words, the Java bean will be used as a temporary storage of each row in the ResultSet, and I would like to avoid creating such a bean for each Jasper report, if possible.
Cheers Don
source share