Is there a Jdbc standard a way to filter the result return by a jdbcTemplate.query by offset and limit?
Also is there a simple way to transform a ResultSet (returned by a filtered query, like the above) into a List<Map<String,String>> result? Where the List is the row where the row values is stored in the Map? The row name being the map key and the row value being the map value.
Or there is a standard way of getting the rows out of a ResultSet?
Take a look at JdbcTemplate#setMaxRows(int)
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.html#setMaxRows%28int%29
This should apply a LIMIT/TOP.
—
I don’t think OFFSET is so well defined, you may need to shoehorn that into your SQL statement in the relevant SQL dialect.
—
To filter the rows returned by JDBC driver and possibly build into Java user-defined object types look at check out the ResultSetExtractor and RowMapper.
ResultSetExtractor this is used to iterate over the ResultSet using ResultSet#next() this allows it to filter and skip based on business logic. This method might make use of a RowMapper type to extract a single row of data it wants to keep, or it may do the extraction itself.
http://static.springsource.org/spring/docs/3.0.x/api/org/springframework/jdbc/core/ResultSetExtractor.html
RowMapper this is used to make a single row into some valid, it could just be a List. This method uses ResultSet#getWhatever(int).
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jdbc/core/RowMapper.html
Then check the JdbcTemplate methods that take a ResultSetExtractor type as one of the arguments. This maybe a good example to start with:
http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jdbc/core/JdbcTemplate.html#query%28java.lang.String,%20java.lang.Object%5B%5D,%20org.springframework.jdbc.core.ResultSetExtractor%29