Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.access.jdbc
Class DistinctResultIterator

    java.lang.Object
      org.apache.cayenne.access.jdbc.DistinctResultIterator

All Implemented Interfaces:
  ResultIterator

    public class DistinctResultIterator

extends java.lang.Object
implements ResultIterator

A ResultIterator that does in-memory filtering of rows to return only distinct rows. Distinct comparison is done by comparing ObjectIds created from each row. Internally DistinctResultIterator wraps another ResultIterator that provides the actual rows.

Since:
  3.0

Field Summary
`protected boolean` | `compareFullRows`
`protected DbEntity` | `defaultEntity`
`protected java.util.Set<java.util.Map<java.lang.String,java.lang.Object>>` | `fetchedIds`
`protected java.lang.Object` | `nextDataRow`
`protected ResultIterator` | `wrappedIterator`

Constructor Summary
`DistinctResultIterator(ResultIterator wrappedIterator, DbEntity defaultEntity, boolean compareFullRows)` Creates new DistinctResultIterator wrapping another ResultIterator.

Method Summary
`java.util.List<?>` | `allRows()` Returns all yet unread rows from ResultSet without closing it.
`void` | `close()` CLoses underlying ResultIterator.
`boolean` | `hasNextRow()` Returns true if there is at least one more record that can be read from the iterator.
`java.lang.Object` | `nextRow()` Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.
`void` | `skipRow()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### wrappedIterator

    protected ResultIterator wrappedIterator

### fetchedIds

    protected java.util.Set<java.util.Map<java.lang.String,java.lang.Object>> fetchedIds

### nextDataRow

    protected java.lang.Object nextDataRow

### defaultEntity

    protected DbEntity defaultEntity

### compareFullRows

    protected boolean compareFullRows

Constructor Detail

### DistinctResultIterator

    public DistinctResultIterator(ResultIterator wrappedIterator,
                                  DbEntity defaultEntity,
                                  boolean compareFullRows)
                           throws CayenneException

  Creates new DistinctResultIterator wrapping another ResultIterator.

  Parameters:
    `wrappedIterator` -
    `defaultEntity` - an entity needed to build ObjectIds for distinct comparison.
  Throws:
    `CayenneException`

Method Detail

### close

    public void close()
               throws CayenneException

  CLoses underlying ResultIterator.

  Specified by:
    `close` in interface `ResultIterator`
  Throws:
    `CayenneException`

### allRows

    public java.util.List<?> allRows()
                              throws CayenneException

  Description copied from interface: `ResultIterator`
  Returns all yet unread rows from ResultSet without closing it.

  Specified by:
    `allRows` in interface `ResultIterator`
  Throws:
    `CayenneException`
  Since:
    3.0

### hasNextRow

    public boolean hasNextRow()
                       throws CayenneException

  Description copied from interface: `ResultIterator`
  Returns true if there is at least one more record that can be read from the iterator.

  Specified by:
    `hasNextRow` in interface `ResultIterator`
  Throws:
    `CayenneException`

### nextRow

    public java.lang.Object nextRow()
                             throws CayenneException

  Description copied from interface: `ResultIterator`
  Returns the next result row that is, depending on the query, may be a scalar value, a DataRow, or an Object[] array containing a mix of scalars and DataRows.

  Specified by:
    `nextRow` in interface `ResultIterator`
  Throws:
    `CayenneException`

### skipRow

    public void skipRow()
                 throws CayenneException

  Specified by:
    `skipRow` in interface `ResultIterator`
  Throws:
    `CayenneException`
  Since:
    3.0

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2012 Apache Cayenne. All Rights Reserved.