findEach (process large queries, one bean at a time)

This method is appropriate to process very large query results as the beans are consumed one at a time and do not need to be held in memory (unlike findList findSet etc)

Note that findEach (and findEachWhile and findIterate) uses a "per graph" persistence context scope and adjusts jdbc fetch buffer size for large queries. As such it is better to use findList for small queries.

Note that internally Ebean can inform the JDBC driver that it is expecting larger resultSet and specifically for MySQL this hint is required to stop it's JDBC driver from buffering the entire resultSet. As such, for smaller resultSets findList() is generally preferable.

Compared with findEachWhile this will always process all the beans where as findEachWhile provides a way to stop processing the query result early before all the beans have been read.

This method is functionally equivalent to findIterate() but instead of using an iterator uses the Consumer interface which is better suited to use with Java8 closures.

   .where().eq("status", Status.NEW)
   .findEach((Customer customer) -> {

     // do something with customer
     System.out.println("-- visit " + customer);