EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.queries
Class ScrollableCursor

java.lang.Object
  extended by org.eclipse.persistence.queries.Cursor
      extended by 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
protected  java.lang.Object nextObject
           
protected  java.lang.Object previousObject
           
protected  org.eclipse.persistence.internal.sessions.AbstractRecord previousRow
          Store 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
ScrollableCursor()
          INTERNAL: Default constructor.
ScrollableCursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, ScrollableCursorPolicy policy)
          INTERNAL: constructor.
 
Method Summary
 boolean absolute(int rows)
          PUBLIC: Moves the cursor to the given row number in the result set
 void add(java.lang.Object object)
          PUBLIC: Add is not support for scrollable cursors.
 void afterLast()
          PUBLIC: Moves the cursor to the end of the result set, just after the last row.
 void beforeFirst()
          PUBLIC: Moves the cursor to the front of the result set, just before the first row
protected  void clearNextAndPrevious()
          INTERNAL: Clear the cache next and previous values.
 int currentIndex()
          PUBLIC: Retrieves the current row index number
 boolean first()
          PUBLIC: Moves the cursor to the first row in the result set
protected  int getCursorSize()
          INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.
protected  int getKnownCursorSize()
           
protected  java.lang.Object getNextObject()
           
 int getPosition()
          PUBLIC: Retrieves the current cursor position (current row).
protected  java.lang.Object getPreviousObject()
           
 boolean hasMoreElements()
          PUBLIC: Indicates whether the cursor can move to the the next row
 boolean hasNext()
          PUBLIC: Indicates whether the cursor can move to the the next row
 boolean hasNextElement()
          PUBLIC: Indicates whether the cursor can move to the the next row
 boolean hasPrevious()
          PUBLIC: Indicates whether the cursor can move to the the previous row
 boolean isAfterLast()
          PUBLIC: Indicates whether the cursor is after the last row in the result set.
 boolean isBeforeFirst()
          PUBLIC: Indicates whether the cursor is before the first row in the result set.
 boolean isFirst()
          PUBLIC: Indicates whether the cursor is on the first row of the result set.
 boolean isLast()
          PUBLIC: Indicates whether the cursor is on the last row of the result set.
 boolean last()
          PUBLIC: Moves the cursor to the last row in the result set
protected  void loadNext()
          Load the next object
protected  void loadPrevious()
          Load the previous object.
 java.lang.Object next()
          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.Object nextElement()
          PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor.
 int nextIndex()
          PUBLIC: Retrieves the next row index (against the current row)
 java.lang.Object previous()
          PUBLIC: Return the previous object from the collection.
 int previousIndex()
          PUBLIC: Retrieves the previous row index (against the current row)
 boolean relative(int rows)
          PUBLIC: Moves the cursor a relative number of rows, either positive or negative.
protected  java.lang.Object retrieveNextObject()
          INTERNAL: Read the next row from the result set.
protected  java.lang.Object retrievePreviousObject()
          INTERNAL: CR#4139 Read the previous row from the result set.
 void set(java.lang.Object object)
          PUBLIC: Set is not supported for scrollable cursors.
protected  void setNextObject(java.lang.Object nextObject)
           
protected  void setPreviousObject(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
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.ListIterator
remove
 

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.

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 DatabaseException
PUBLIC: Moves the cursor to the given row number in the result set

Throws:
DatabaseException

add

public void add(java.lang.Object object)
         throws QueryException
PUBLIC: Add is not support for scrollable cursors.

Specified by:
add in interface java.util.ListIterator
Throws:
QueryException

afterLast

public void afterLast()
               throws DatabaseException
PUBLIC: Moves the cursor to the end of the result set, just after the last row.

Throws:
DatabaseException

beforeFirst

public void beforeFirst()
                 throws DatabaseException
PUBLIC: Moves the cursor to the front of the result set, just before the first row

Throws:
DatabaseException

clearNextAndPrevious

protected void clearNextAndPrevious()
INTERNAL: Clear the cache next and previous values. This must be called whenever the cursor is re-positioned.


currentIndex

public int currentIndex()
                 throws DatabaseException
PUBLIC: Retrieves the current row index number

Throws:
DatabaseException

first

public boolean first()
              throws DatabaseException
PUBLIC: Moves the cursor to the first row in the result set

Throws:
DatabaseException

getCursorSize

protected int getCursorSize()
                     throws DatabaseException
INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.

Specified by:
getCursorSize in class Cursor
Throws:
DatabaseException

getKnownCursorSize

protected int getKnownCursorSize()

getNextObject

protected java.lang.Object getNextObject()

getPosition

public int getPosition()
                throws DatabaseException
PUBLIC: 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:
getPosition in class Cursor
Returns:
the current row number; 0 if there is no current row
Throws:
java.sql.SQLException - if a database access error occurs
DatabaseException

getPreviousObject

protected java.lang.Object getPreviousObject()

hasMoreElements

public boolean hasMoreElements()
                        throws DatabaseException
PUBLIC: Indicates whether the cursor can move to the the next row

Specified by:
hasMoreElements in interface java.util.Enumeration
Throws:
DatabaseException

hasNext

public boolean hasNext()
                throws DatabaseException
PUBLIC: Indicates whether the cursor can move to the the next row

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in interface java.util.ListIterator
Throws:
DatabaseException

hasNextElement

public boolean hasNextElement()
                       throws DatabaseException
PUBLIC: Indicates whether the cursor can move to the the next row

Throws:
DatabaseException

hasPrevious

public boolean hasPrevious()
                    throws DatabaseException
PUBLIC: Indicates whether the cursor can move to the the previous row

Specified by:
hasPrevious in interface java.util.ListIterator
Throws:
DatabaseException

isAfterLast

public boolean isAfterLast()
                    throws DatabaseException
PUBLIC: Indicates whether the cursor is after the last row in the result set.

Throws:
DatabaseException

isBeforeFirst

public boolean isBeforeFirst()
                      throws DatabaseException
PUBLIC: Indicates whether the cursor is before the first row in the result set.

Throws:
DatabaseException

isFirst

public boolean isFirst()
                throws DatabaseException
PUBLIC: Indicates whether the cursor is on the first row of the result set.

Throws:
DatabaseException

isLast

public boolean isLast()
               throws DatabaseException
PUBLIC: Indicates whether the cursor is on the last row of the result set.

Throws:
DatabaseException

last

public boolean last()
             throws DatabaseException
PUBLIC: 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,
                             QueryException
PUBLIC: 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:
next in interface java.util.Iterator
Specified by:
next in interface java.util.ListIterator
Returns:
- next object in stream
Throws:
- - throws exception if read pass end of stream
DatabaseException
QueryException

next

public java.util.List<java.lang.Object> next(int number)
                                      throws DatabaseException
PUBLIC: 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:
- - throws exception if read pass end of stream
DatabaseException

nextElement

public java.lang.Object nextElement()
                             throws DatabaseException,
                                    QueryException
PUBLIC: Return the next object from the collection, if beyond the read limit read from the cursor.

Specified by:
nextElement in interface java.util.Enumeration
Returns:
next object in stream
Throws:
DatabaseException
QueryException

nextIndex

public int nextIndex()
              throws DatabaseException
PUBLIC: Retrieves the next row index (against the current row)

Specified by:
nextIndex in interface java.util.ListIterator
Throws:
DatabaseException

previous

public java.lang.Object previous()
                          throws DatabaseException,
                                 QueryException
PUBLIC: Return the previous object from the collection.

Specified by:
previous in interface java.util.ListIterator
Returns:
- previous object in stream
Throws:
- - throws exception if read pass first of stream
DatabaseException
QueryException

previousIndex

public int previousIndex()
                  throws DatabaseException
PUBLIC: Retrieves the previous row index (against the current row)

Specified by:
previousIndex in interface java.util.ListIterator
Throws:
DatabaseException

relative

public boolean relative(int rows)
                 throws DatabaseException
PUBLIC: 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 DatabaseException
INTERNAL: Read the next row from the result set.

Specified by:
retrieveNextObject in class Cursor
Throws:
DatabaseException

retrievePreviousObject

protected java.lang.Object retrievePreviousObject()
                                           throws DatabaseException
INTERNAL: 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 QueryException
PUBLIC: Set is not supported for scrollable cursors.

Specified by:
set in interface java.util.ListIterator
Throws:
QueryException

setNextObject

protected void setNextObject(java.lang.Object nextObject)

setPreviousObject

protected void setPreviousObject(java.lang.Object previousObject)

EclipseLink 2.2.0, build 'v20110202-r8913' API Reference