title: Paged queries with JdbcTemplate
body: <p>I'm currently working on a migration project, to migrate data from the old db to the new one (please do not ask why I'm going through a Java application for this, it's what the customer requires).</p>
  
  <p>There was some, initial, code which I'm updating now. One of the things I'm changing is using Spring's <code>JdbcTemplate</code> rather then the boiler-plate code which was there.</p>
  
  <p>Unfortunately, I haven't found a way yet to execute paged queries on a <code>JdbcTemplate</code>, analogue to the old code:</p>
  
  <pre><code>Statement statement = getConnection().createStatement(
      ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
  statement.setFetchDirection(ResultSet.FETCH_FORWARD);
  statement.setFetchSize(1000);
  return statement.executeQuery();
  </code></pre>
  
  <p>The <code>getConnection()</code> just return a <code>Connection</code> object, created in plain JDBC code (it's not part of a <code>SessionFactory</code> or a framework implementation).</p>
  
  <p>I would then loop over the resultset, mapping the rows one at a time. Does anyone know if there's an easy way to achieve the same functionality with <code>JdbcTemplate</code>?</p>
  
  <p>TIA</p>