Let\'s say I have a table with millions of rows. Using JPA, what\'s the proper way to iterate over a query against that table, such that I don\'t have all an in-memo
You can't really do this in straight JPA, however Hibernate has support for stateless sessions and scrollable result sets.
We routinely process billions of rows with its help.
Here is a link to documentation: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/batch.html#batch-statelesssession