Package io.ebean

Interface RowConsumer

  • Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    public interface RowConsumer
    Used with SqlQuery to process potentially large queries reading directly from the JDBC ResultSet.

    This provides a low level option that reads directly from the JDBC ResultSet.

    
    
      String sql = "select id, name, status from o_customer order by name desc";
    
      DB.sqlQuery(sql)
        .findEachRow((resultSet, rowNum) -> {
    
          // read directly from ResultSet
    
          long id = resultSet.getLong(1);
          String name = resultSet.getString(2);
    
          // do something interesting with the data
    
        });
    
     
    • Method Detail

      • accept

        void accept​(ResultSet resultSet,
                    int rowNum)
             throws SQLException
        Read the data from the ResultSet and process it.
        Parameters:
        resultSet - The JDBC ResultSet positioned to the current row
        rowNum - The number of the current row being mapped.
        Throws:
        SQLException