I'm using spring java.
I need to return a Stream of objects from the database query (I use ObjectMapper to map them to JSON).
The query results can be quite large (over 500k objects) so I don't want to store them in memory.
I've done it with JpaRepository.
I'd like to know how it can be done with JdbcTemplate and if there would be an advantage to do so?
I.e ... can we optimize the throughput and memory usage using JdbcTemplate or perhaps even other libraries.
My goal is really at the end to find the optimal way to run a query and print all objects to an output stream in terms of memory/time/processing.