Top Description Fields Constructors Methods
org.eclipse.persistence.queries

public abstract Class Cursor

extends Object
implements Enumeration, Iterator, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.util.Iterator, java.util.Enumeration
Known Direct Subclasses
org.eclipse.persistence.queries.CursoredStream, org.eclipse.persistence.queries.ScrollableCursor
Imports
java.sql.*, java.util.*, org.eclipse.persistence.exceptions.*, org.eclipse.persistence.expressions.*, org.eclipse.persistence.internal.databaseaccess.*, org.eclipse.persistence.internal.helper.*, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .UnitOfWorkImpl

Purpose: Abstract class for CursoredStream and ScrolableCursor

Field Summary

Modifier and TypeField and Description
protected transient AbstractSession
executionSession

The root session that executed the call for the query.

protected transient Vector<DatabaseField>
fields

The fields expected in the result set.

protected Map<Object, Object>
initiallyConformingIndex

Conforming instances found in memory when building the result.

protected AbstractRecord
nextRow

Store the next row, for 1-m joining.

protected List<Object>
objectCollection

Internal collection of objects.

public transient CursorPolicy
policy

Query policy that initialize the stream.

protected int
position

Current position in the objectCollection of the stream.

public transient ReadQuery
query

Read query that initialize the stream.

protected transient ResultSet
resultSet

The result set (cursor) that holds the handle to the database that the results are read from.

protected Expression
selectionCriteriaClone

SelectionCriteria & translation row ready for incremental conforming.

protected transient AbstractSession
session

The session that executed the query for the stream.

protected int
size

Cached size of the stream.

protected transient Statement
statement

The preparedStatement that holds the handle to the database that the results are read from.

protected AbstractRecord

Constructor Summary

AccessConstructor and Description
protected
Cursor()

INTERNAL: Default constructor.

protected
Cursor(DatabaseCall call, CursorPolicy policy)

INTERNAL:

Method Summary

Modifier and TypeMethod and Description
protected Object
buildAndRegisterObject(AbstractRecord row)

INTERNAL: builds and registers an object from a row for cursors.

public void
clear()

PUBLIC: Release all objects read in so far.

public void
close()

PUBLIC: Closes the stream.

protected void
finalize()

Overrides java.lang.Object.finalize.

Close in case not closed.
public DatabaseAccessor
getAccessor()

INTERNAL: Return the accessor associated with the cursor.

protected abstract int
getCursorSize()

INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.

public AbstractSession
getExecutionSession()

INTERNAL: Returns the session the underlying call was executed on.

public Vector<DatabaseField>
getFields()

INTERNAL: Return the fields for the stream.

public Map<Object, Object>
getInitiallyConformingIndex()

INTERNAL: Conforming instances found in memory when building the result.

public List<Object>
getObjectCollection()

INTERNAL: Return the internal object collection that stores the objects.

public int
getPageSize()

INTERNAL: Return the number of items to be faulted in for the stream.

public CursorPolicy
getPolicy()

INTERNAL: Return the cursor policy.

public abstract int
getPosition()

INTERNAL: Return the position of the stream inside the object collection.

public ReadQuery
getQuery()

INTERNAL: Return the query associated with the stream.

public ResultSet
getResultSet()

INTERNAL: Return the result set (cursor).

public Expression
getSelectionCriteriaClone()

INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.

public AbstractSession
getSession()

INTERNAL: Return the handle to the session

protected Statement
getStatement()

INTERNAL: Return the Statement.

protected AbstractRecord
getTranslationRow()

INTERNAL: Gets the translation row the query was executed with, used for incremental conforming.

public boolean
isClosed()

PUBLIC: Return if the stream is closed.

public void
remove()

Overrides default java.util.Iterator.remove.

PUBLIC: Remove is not support with cursors.
protected abstract Object
retrieveNextObject()

INTERNAL: Read the next row from the result set.

protected void
setExecutionSession(AbstractSession executionSession)

INTERNAL: Sets the session the underlying call was executed on.

protected void
setFields(Vector<DatabaseField> fields)

INTERNAL: Set the fields for the stream.

public void
setInitiallyConformingIndex(Map<Object, Object> index)

INTERNAL: Conforming instances found in memory when building the result.

public void
setObjectCollection(List<Object> collection)

INTERNAL: Set the internal object collection

public void
setPolicy(CursorPolicy policy)

INTERNAL: Set the cursor policy.

protected void
setPosition(int value)

INTERNAL: Set the current position of the stream

protected void
setResultSet(ResultSet result)

INTERNAL: Set the result set (cursor)

public void
setSelectionCriteriaClone(Expression expression)

INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.

public void
setSession(AbstractSession databaseSession)

INTERNAL: Set the session handle

public void
setSize(int size)

INTERNAL: Set the cache size

public void
setTranslationRow(AbstractRecord row)

INTERNAL: Sets the translation row this query was executed with.

public int
size()

PUBLIC: Retrieve the size of the open cursor by executing a count on the same query as the cursor.

Inherited from java.lang.Object:
cloneequalsgetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executionSessionback to summary
protected transient AbstractSession executionSession

The root session that executed the call for the query. Knows the database platform.

fieldsback to summary
protected transient Vector<DatabaseField> fields

The fields expected in the result set.

initiallyConformingIndexback to summary
protected Map<Object, Object> initiallyConformingIndex

Conforming instances found in memory when building the result.

nextRowback to summary
protected AbstractRecord nextRow

Store the next row, for 1-m joining.

objectCollectionback to summary
protected List<Object> objectCollection

Internal collection of objects.

policyback to summary
public transient CursorPolicy policy

Query policy that initialize the stream.

positionback to summary
protected int position

Current position in the objectCollection of the stream.

queryback to summary
public transient ReadQuery query

Read query that initialize the stream.

resultSetback to summary
protected transient ResultSet resultSet

The result set (cursor) that holds the handle to the database that the results are read from.

selectionCriteriaCloneback to summary
protected Expression selectionCriteriaClone

SelectionCriteria & translation row ready for incremental conforming.

sessionback to summary
protected transient AbstractSession session

The session that executed the query for the stream.

sizeback to summary
protected int size

Cached size of the stream.

statementback to summary
protected transient Statement statement

The preparedStatement that holds the handle to the database that the results are read from.

translationRowback to summary
protected AbstractRecord translationRow

Constructor Detail

Cursorback to summary
protected Cursor()

INTERNAL: Default constructor.

Cursorback to summary
protected Cursor(DatabaseCall call, CursorPolicy policy)

INTERNAL:

Method Detail

buildAndRegisterObjectback to summary
protected Object buildAndRegisterObject(AbstractRecord row)

INTERNAL: builds and registers an object from a row for cursors. Behavior is different from the query version in that refreshing is not supported.

clearback to summary
public void clear()

PUBLIC: Release all objects read in so far. This should be performed when reading in a large collection of objects in order to preserve memory.

closeback to summary
public void close() throws DatabaseException

PUBLIC: Closes the stream. This should be performed whenever the user has finished with the stream.

finalizeback to summary
protected void finalize() throws DatabaseException

Overrides java.lang.Object.finalize.

Close in case not closed.

Annotations
@Override
getAccessorback to summary
public DatabaseAccessor getAccessor()

INTERNAL: Return the accessor associated with the cursor.

getCursorSizeback to summary
protected abstract int getCursorSize() throws DatabaseException, QueryException

INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.

getExecutionSessionback to summary
public AbstractSession getExecutionSession()

INTERNAL: Returns the session the underlying call was executed on. This root session knows the database platform.

getFieldsback to summary
public Vector<DatabaseField> getFields()

INTERNAL: Return the fields for the stream.

getInitiallyConformingIndexback to summary
public Map<Object, Object> getInitiallyConformingIndex()

INTERNAL: Conforming instances found in memory when building the result. These objects are returned first by the cursor, and a fast lookup is needed to make sure the same objects appearing in the cursor are filtered out.

getObjectCollectionback to summary
public List<Object> getObjectCollection()

INTERNAL: Return the internal object collection that stores the objects.

getPageSizeback to summary
public int getPageSize()

INTERNAL: Return the number of items to be faulted in for the stream.

getPolicyback to summary
public CursorPolicy getPolicy()

INTERNAL: Return the cursor policy.

getPositionback to summary
public abstract int getPosition()

INTERNAL: Return the position of the stream inside the object collection.

getQueryback to summary
public ReadQuery getQuery()

INTERNAL: Return the query associated with the stream.

getResultSetback to summary
public ResultSet getResultSet()

INTERNAL: Return the result set (cursor).

getSelectionCriteriaCloneback to summary
public Expression getSelectionCriteriaClone()

INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.

getSessionback to summary
public AbstractSession getSession()

INTERNAL: Return the handle to the session

getStatementback to summary
protected Statement getStatement()

INTERNAL: Return the Statement.

getTranslationRowback to summary
protected AbstractRecord getTranslationRow()

INTERNAL: Gets the translation row the query was executed with, used for incremental conforming.

isClosedback to summary
public boolean isClosed()

PUBLIC: Return if the stream is closed.

removeback to summary
public void remove() throws QueryException

Overrides default java.util.Iterator.remove.

PUBLIC: Remove is not support with cursors.

Annotations
@Override
retrieveNextObjectback to summary
protected abstract Object retrieveNextObject() throws DatabaseException

INTERNAL: Read the next row from the result set.

setExecutionSessionback to summary
protected void setExecutionSession(AbstractSession executionSession)

INTERNAL: Sets the session the underlying call was executed on. This root session knows the database platform.

setFieldsback to summary
protected void setFields(Vector<DatabaseField> fields)

INTERNAL: Set the fields for the stream.

setInitiallyConformingIndexback to summary
public void setInitiallyConformingIndex(Map<Object, Object> index)

INTERNAL: Conforming instances found in memory when building the result. These objects are returned first by the cursor, and a fast lookup is needed to make sure the same objects appearing in the cursor are filtered out.

setObjectCollectionback to summary
public void setObjectCollection(List<Object> collection)

INTERNAL: Set the internal object collection

setPolicyback to summary
public void setPolicy(CursorPolicy policy)

INTERNAL: Set the cursor policy.

setPositionback to summary
protected void setPosition(int value)

INTERNAL: Set the current position of the stream

setResultSetback to summary
protected void setResultSet(ResultSet result)

INTERNAL: Set the result set (cursor)

setSelectionCriteriaCloneback to summary
public void setSelectionCriteriaClone(Expression expression)

INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.

setSessionback to summary
public void setSession(AbstractSession databaseSession)

INTERNAL: Set the session handle

setSizeback to summary
public void setSize(int size)

INTERNAL: Set the cache size

setTranslationRowback to summary
public void setTranslationRow(AbstractRecord row)

INTERNAL: Sets the translation row this query was executed with. Used for incremental conforming.

sizeback to summary
public int size() throws DatabaseException

PUBLIC: Retrieve the size of the open cursor by executing a count on the same query as the cursor. If this cursor is conforming size() can only be an estimate. cursor size plus number of conforming instances found in memory will be returned. The union (actual result) may be smaller than this.