title: Large list returned from a SimpleJdbcTemplate query
body: <p>here is my problem : at some point in my Java program, I get a (very) big List of Events from a database using the SimpleJdbcTemplate class from Spring.</p>
  
  <pre><code>List&lt;Event&gt; events = 
              this.simpleJdbcTemplate.query(myQuery,
              myMapper(), 
              new Object[] {
                      filter.getFirst(),
                      filter.getSecond(),
                      filter.getThird()}
              );
  </code></pre>
  
  <p>The problem is that the list may contain something like 600,000 Events ... Therefore using a lot of memory (and also taking time to be processed).</p>
  
  <p>However I don't really need to retrieve all the Events at once. Actually I would like to be able to iterate over the list, read only a few events (linked to a specific KEY_ID - the sql query myQuery is ordered by KEY_ID), process them and finally get back iterating, letting the garbage collector get rid of the previous and already processed Events so that I never exceed a certain amount of memory.</p>
  
  <p>Is there a nice way to do so using the Spring library (or any library)?</p>
  
  <p>Cheers,
  Vakimshaar.</p>