Package org.eclipse.persistence.queries
Class ScrollableCursor
- java.lang.Object
-
- org.eclipse.persistence.queries.Cursor
-
- org.eclipse.persistence.queries.ScrollableCursor
-
- All Implemented Interfaces:
java.io.Serializable,java.util.Enumeration,java.util.Iterator,java.util.ListIterator
public class ScrollableCursor extends Cursor implements java.util.ListIterator
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanatEndOfCursorInternal flag indicating if the end of the cursor has been reachedprotected java.lang.ObjectnextObjectprotected java.lang.ObjectpreviousObjectprotected org.eclipse.persistence.internal.sessions.AbstractRecordpreviousRowStore the previous row, for 1-m joining.-
Fields inherited from class org.eclipse.persistence.queries.Cursor
executionSession, fields, initiallyConformingIndex, nextRow, objectCollection, policy, position, query, resultSet, selectionCriteriaClone, session, size, statement, translationRow
-
-
Constructor Summary
Constructors Constructor Description ScrollableCursor()INTERNAL: Default constructor.ScrollableCursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, ScrollableCursorPolicy policy)INTERNAL: constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanabsolute(int rows)PUBLIC: Moves the cursor to the given row number in the result setvoidadd(java.lang.Object object)PUBLIC: Add is not support for scrollable cursors.voidafterLast()PUBLIC: Moves the cursor to the end of the result set, just after the last row.voidbeforeFirst()PUBLIC: Moves the cursor to the front of the result set, just before the first rowprotected voidclearNextAndPrevious()INTERNAL: Clear the cached next and previous object and row values.protected voidclearNextAndPreviousObject()INTERNAL: Clear only the cached next and previous object values.intcurrentIndex()PUBLIC: Retrieves the current row index numberbooleanfirst()PUBLIC: Moves the cursor to the first row in the result setprotected intgetCursorSize()INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.protected intgetKnownCursorSize()protected java.lang.ObjectgetNextObject()intgetPosition()PUBLIC: Retrieves the current cursor position (current row).protected java.lang.ObjectgetPreviousObject()booleanhasMoreElements()PUBLIC: Indicates whether the cursor can move to the the next rowbooleanhasNext()PUBLIC: Indicates whether the cursor can move to the the next rowbooleanhasNextElement()PUBLIC: Indicates whether the cursor can move to the the next rowbooleanhasPrevious()PUBLIC: Indicates whether the cursor can move to the the previous rowbooleanisAfterLast()PUBLIC: Indicates whether the cursor is after the last row in the result set.booleanisBeforeFirst()PUBLIC: Indicates whether the cursor is before the first row in the result set.booleanisFirst()PUBLIC: Indicates whether the cursor is on the first row of the result set.booleanisLast()PUBLIC: Indicates whether the cursor is on the last row of the result set.booleanlast()PUBLIC: Moves the cursor to the last row in the result setprotected voidloadNext()Load the next objectprotected voidloadPrevious()Load the previous object.java.lang.Objectnext()PUBLIC: This method differs slightly from conventional read() operation on a Java stream.java.util.List<java.lang.Object>next(int number)PUBLIC: This method differs slightly from conventional read() operation on a Java stream.java.lang.ObjectnextElement()PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor.intnextIndex()PUBLIC: Retrieves the next row index (against the current row)java.lang.Objectprevious()PUBLIC: Return the previous object from the collection.intpreviousIndex()PUBLIC: Retrieves the previous row index (against the current row)booleanrelative(int rows)PUBLIC: Moves the cursor a relative number of rows, either positive or negative.protected java.lang.ObjectretrieveNextObject()INTERNAL: Read the next row from the result set.protected java.lang.ObjectretrievePreviousObject()INTERNAL: CR#4139 Read the previous row from the result set.voidset(java.lang.Object object)PUBLIC: Set is not supported for scrollable cursors.protected voidsetNextObject(java.lang.Object nextObject)protected voidsetPreviousObject(java.lang.Object previousObject)-
Methods inherited from class org.eclipse.persistence.queries.Cursor
buildAndRegisterObject, clear, close, finalize, getAccessor, getExecutionSession, getFields, getInitiallyConformingIndex, getObjectCollection, getPageSize, getPolicy, getQuery, getResultSet, getSelectionCriteriaClone, getSession, getStatement, getTranslationRow, isClosed, remove, setExecutionSession, setFields, setInitiallyConformingIndex, setObjectCollection, setPolicy, setPosition, setResultSet, setSelectionCriteriaClone, setSession, setSize, setTranslationRow, size
-
-
-
-
Field Detail
-
nextObject
protected transient java.lang.Object nextObject
-
previousObject
protected transient java.lang.Object previousObject
-
previousRow
protected org.eclipse.persistence.internal.sessions.AbstractRecord previousRow
Store the previous row, for 1-m joining.
-
atEndOfCursor
protected boolean atEndOfCursor
Internal flag indicating if the end of the cursor has been reached
-
-
Constructor Detail
-
ScrollableCursor
public ScrollableCursor()
INTERNAL: Default constructor.
-
ScrollableCursor
public ScrollableCursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, ScrollableCursorPolicy policy)INTERNAL: constructor.
-
-
Method Detail
-
absolute
public boolean absolute(int rows) throws DatabaseExceptionPUBLIC: Moves the cursor to the given row number in the result set- Throws:
DatabaseException
-
add
public void add(java.lang.Object object) throws QueryExceptionPUBLIC: Add is not support for scrollable cursors.- Specified by:
addin interfacejava.util.ListIterator- Throws:
QueryException
-
afterLast
public void afterLast() throws DatabaseExceptionPUBLIC: Moves the cursor to the end of the result set, just after the last row.- Throws:
DatabaseException
-
beforeFirst
public void beforeFirst() throws DatabaseExceptionPUBLIC: Moves the cursor to the front of the result set, just before the first row- Throws:
DatabaseException
-
clearNextAndPrevious
protected void clearNextAndPrevious()
INTERNAL: Clear the cached next and previous object and row values. This must be called whenever the cursor is re-positioned.
-
clearNextAndPreviousObject
protected void clearNextAndPreviousObject()
INTERNAL: Clear only the cached next and previous object values. Called by previous() and next() to maintain the cached next and previous row values.
-
currentIndex
public int currentIndex() throws DatabaseExceptionPUBLIC: Retrieves the current row index number- Throws:
DatabaseException
-
first
public boolean first() throws DatabaseExceptionPUBLIC: Moves the cursor to the first row in the result set- Throws:
DatabaseException
-
getCursorSize
protected int getCursorSize() throws DatabaseExceptionINTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.- Specified by:
getCursorSizein classCursor- Throws:
DatabaseException
-
getKnownCursorSize
protected int getKnownCursorSize()
-
getNextObject
protected java.lang.Object getNextObject()
-
getPosition
public int getPosition() throws DatabaseExceptionPUBLIC: Retrieves the current cursor position (current row). The first row is number 1, the second number 2, and so on. Unlike java.sql.ResultSet.getRow(), 0 is not returned if afterLast. Instead size() + 1 is returned.- Specified by:
getPositionin classCursor- Returns:
- the current row number; 0 if there is no current row
- Throws:
DatabaseException- if a database access error occurs
-
getPreviousObject
protected java.lang.Object getPreviousObject()
-
hasMoreElements
public boolean hasMoreElements() throws DatabaseExceptionPUBLIC: Indicates whether the cursor can move to the the next row- Specified by:
hasMoreElementsin interfacejava.util.Enumeration- Throws:
DatabaseException
-
hasNext
public boolean hasNext() throws DatabaseExceptionPUBLIC: Indicates whether the cursor can move to the the next row- Specified by:
hasNextin interfacejava.util.Iterator- Specified by:
hasNextin interfacejava.util.ListIterator- Throws:
DatabaseException
-
hasNextElement
public boolean hasNextElement() throws DatabaseExceptionPUBLIC: Indicates whether the cursor can move to the the next row- Throws:
DatabaseException
-
hasPrevious
public boolean hasPrevious() throws DatabaseExceptionPUBLIC: Indicates whether the cursor can move to the the previous row- Specified by:
hasPreviousin interfacejava.util.ListIterator- Throws:
DatabaseException
-
isAfterLast
public boolean isAfterLast() throws DatabaseExceptionPUBLIC: Indicates whether the cursor is after the last row in the result set.- Throws:
DatabaseException
-
isBeforeFirst
public boolean isBeforeFirst() throws DatabaseExceptionPUBLIC: Indicates whether the cursor is before the first row in the result set.- Throws:
DatabaseException
-
isFirst
public boolean isFirst() throws DatabaseExceptionPUBLIC: Indicates whether the cursor is on the first row of the result set.- Throws:
DatabaseException
-
isLast
public boolean isLast() throws DatabaseExceptionPUBLIC: Indicates whether the cursor is on the last row of the result set.- Throws:
DatabaseException
-
last
public boolean last() throws DatabaseExceptionPUBLIC: Moves the cursor to the last row in the result set- Throws:
DatabaseException
-
loadNext
protected void loadNext()
Load the next object
-
loadPrevious
protected void loadPrevious()
Load the previous object. This is used solely for scrollable cursor support
-
next
public java.lang.Object next() throws DatabaseException, QueryExceptionPUBLIC: This method differs slightly from conventional read() operation on a Java stream. This method return the next object in the collection rather than specifying the number of bytes to be read in. Return the next object from the collection, if beyond the read limit read from the cursor- Specified by:
nextin interfacejava.util.Iterator- Specified by:
nextin interfacejava.util.ListIterator- Returns:
- - next object in stream
- Throws:
DatabaseException- if read pass end of streamQueryException
-
next
public java.util.List<java.lang.Object> next(int number) throws DatabaseExceptionPUBLIC: This method differs slightly from conventional read() operation on a Java stream. This method returns the next number of objects in the collection in a vector. Return the next specified number of objects from the collection, if beyond the read limit read from the cursor- Parameters:
number- - number of objects to be returned- Returns:
- - vector containing next number of objects
- Throws:
DatabaseException- if read pass end of stream
-
nextElement
public java.lang.Object nextElement() throws DatabaseException, QueryExceptionPUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor.- Specified by:
nextElementin interfacejava.util.Enumeration- Returns:
- next object in stream
- Throws:
DatabaseExceptionQueryException
-
nextIndex
public int nextIndex() throws DatabaseExceptionPUBLIC: Retrieves the next row index (against the current row)- Specified by:
nextIndexin interfacejava.util.ListIterator- Throws:
DatabaseException
-
previous
public java.lang.Object previous() throws DatabaseException, QueryExceptionPUBLIC: Return the previous object from the collection.- Specified by:
previousin interfacejava.util.ListIterator- Returns:
- - previous object in stream
- Throws:
DatabaseException- if read pass first of streamQueryException
-
previousIndex
public int previousIndex() throws DatabaseExceptionPUBLIC: Retrieves the previous row index (against the current row)- Specified by:
previousIndexin interfacejava.util.ListIterator- Throws:
DatabaseException
-
relative
public boolean relative(int rows) throws DatabaseExceptionPUBLIC: Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the result set positions the cursor before/after the the first/last row- Throws:
DatabaseException
-
retrieveNextObject
protected java.lang.Object retrieveNextObject() throws DatabaseExceptionINTERNAL: Read the next row from the result set.- Specified by:
retrieveNextObjectin classCursor- Throws:
DatabaseException
-
retrievePreviousObject
protected java.lang.Object retrievePreviousObject() throws DatabaseExceptionINTERNAL: CR#4139 Read the previous row from the result set. It is used solely for scrollable cursor support.- Throws:
DatabaseException
-
set
public void set(java.lang.Object object) throws QueryExceptionPUBLIC: Set is not supported for scrollable cursors.- Specified by:
setin interfacejava.util.ListIterator- Throws:
QueryException
-
setNextObject
protected void setNextObject(java.lang.Object nextObject)
-
setPreviousObject
protected void setPreviousObject(java.lang.Object previousObject)
-
-