001package com.avaje.ebean;
002
003/**
004 * Provides a mechanism for processing a SqlQuery one SqlRow at a time.
005 * <p>
006 * This is useful when the query will return a large number of results and you
007 * want to process the beans one at a time rather than have all of the beans in
008 * memory at once.
009 * </p>
010 * 
011 * <pre class="code">
012 * SqlQueryListener listener = ...;
013 *    
014 * SqlQuery query  = Ebean.createSqlQuery(&quot;my.large.query&quot;);
015 *    
016 * // set the listener that will process each row one at a time
017 * query.setListener(listener);
018 *    
019 * // execute the query. Note that the returned
020 * // list will be empty ... so don't bother assigning it...
021 * query.findList();
022 * </pre>
023 */
024public interface SqlQueryListener {
025
026  /**
027   * Process the bean that has just been read.
028   * <p>
029   * Note this bean will not be added to the List Set or Map.
030   * </p>
031   */
032  void process(SqlRow bean);
033}