Package org.apache.ibatis.cursor
Interface Cursor<T>
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,java.lang.Iterable<T>
- All Known Implementing Classes:
DefaultCursor
public interface Cursor<T> extends java.io.Closeable, java.lang.Iterable<T>
Cursor contract to handle fetching items lazily using an Iterator. Cursors are a perfect fit to handle millions of items queries that would not normally fits in memory. If you use collections in resultMaps then cursor SQL queries must be ordered (resultOrdered="true") using the id columns of the resultMap.- Author:
- Guillaume Darmont / guillaume@dropinocean.com
-
-
Method Summary
Modifier and Type Method Description int
getCurrentIndex()
Get the current item index.boolean
isConsumed()
boolean
isOpen()
-
-
-
Method Detail
-
isOpen
boolean isOpen()
- Returns:
- true if the cursor has started to fetch items from database.
-
isConsumed
boolean isConsumed()
- Returns:
- true if the cursor is fully consumed and has returned all elements matching the query.
-
getCurrentIndex
int getCurrentIndex()
Get the current item index. The first item has the index 0.- Returns:
- -1 if the first cursor item has not been retrieved. The index of the current item retrieved.
-
-