I'm using Postgres and I have a query whose result set is so large that does not fit into memory. When I call NamedParameterJdbcTemplate.queryForStream I get an out of memory error because the method attempts to read the whole result set before creating a stream based on the in-memory result.
Is there a way to get an actual stream out of the NamedParameterJdbcTemplate? I've managed to get something similar using a JDBC raw connection from Postgres (caveat: you need to disable auto commit for it to work) but in comparison is cumbersome not being able to use all the facilities provided by NamedParameterJdbcTemplate.