Package org.eclipse.persistence.queries
Class Cursor
- java.lang.Object
-
- org.eclipse.persistence.queries.Cursor
-
- All Implemented Interfaces:
Serializable,Enumeration,Iterator
- Direct Known Subclasses:
CursoredStream,ScrollableCursor
public abstract class Cursor extends Object implements Enumeration, Iterator, Serializable
Purpose: Abstract class for CursoredStream and ScrolableCursor
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description CursorPolicypolicyQuery policy that initialize the stream.ReadQueryqueryRead query that initialize the stream.
-
Constructor Summary
Constructors Constructor Description Cursor()INTERNAL: Default constructor.Cursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, CursorPolicy policy)INTERNAL:
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()PUBLIC: Release all objects read in so far.voidclose()PUBLIC: Closes the stream.org.eclipse.persistence.internal.databaseaccess.DatabaseAccessorgetAccessor()INTERNAL: Return the accessor associated with the cursor.org.eclipse.persistence.internal.sessions.AbstractSessiongetExecutionSession()INTERNAL: Returns the session the underlying call was executed on.Vector<org.eclipse.persistence.internal.helper.DatabaseField>getFields()INTERNAL: Return the fields for the stream.Map<Object,Object>getInitiallyConformingIndex()INTERNAL: Conforming instances found in memory when building the result.List<Object>getObjectCollection()INTERNAL: Return the internal object collection that stores the objects.intgetPageSize()INTERNAL: Return the number of items to be faulted in for the stream.CursorPolicygetPolicy()INTERNAL: Return the cursor policy.abstract intgetPosition()INTERNAL: Return the position of the stream inside the object collection.ReadQuerygetQuery()INTERNAL: Return the query associated with the stream.ResultSetgetResultSet()INTERNAL: Return the result set (cursor).ExpressiongetSelectionCriteriaClone()INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.org.eclipse.persistence.internal.sessions.AbstractSessiongetSession()INTERNAL: Return the handle to the sessionbooleanisClosed()PUBLIC: Return if the stream is closed.voidremove()PUBLIC: Remove is not support with cursors.voidsetInitiallyConformingIndex(Map<Object,Object> index)INTERNAL: Conforming instances found in memory when building the result.voidsetObjectCollection(List<Object> collection)INTERNAL: Set the internal object collectionvoidsetPolicy(CursorPolicy policy)INTERNAL: Set the cursor policy.voidsetSelectionCriteriaClone(Expression expression)INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.voidsetSession(org.eclipse.persistence.internal.sessions.AbstractSession databaseSession)INTERNAL: Set the session handlevoidsetSize(int size)INTERNAL: Set the cache sizevoidsetTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)INTERNAL: Sets the translation row this query was executed with.intsize()PUBLIC: Retrieve the size of the open cursor by executing a count on the same query as the cursor.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Enumeration
asIterator, hasMoreElements, nextElement
-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
-
-
-
Field Detail
-
query
public transient ReadQuery query
Read query that initialize the stream.
-
policy
public transient CursorPolicy policy
Query policy that initialize the stream.
-
-
Constructor Detail
-
Cursor
public Cursor()
INTERNAL: Default constructor.
-
Cursor
public Cursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, CursorPolicy policy)INTERNAL:
-
-
Method Detail
-
close
public void close() throws DatabaseExceptionPUBLIC: Closes the stream. This should be performed whenever the user has finished with the stream.- Throws:
DatabaseException
-
getAccessor
public org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor getAccessor()
INTERNAL: Return the accessor associated with the cursor.
-
getFields
public Vector<org.eclipse.persistence.internal.helper.DatabaseField> getFields()
INTERNAL: Return the fields for the stream.
-
getInitiallyConformingIndex
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.
-
getObjectCollection
public List<Object> getObjectCollection()
INTERNAL: Return the internal object collection that stores the objects.
-
getPageSize
public int getPageSize()
INTERNAL: Return the number of items to be faulted in for the stream.
-
getPolicy
public CursorPolicy getPolicy()
INTERNAL: Return the cursor policy.
-
getPosition
public abstract int getPosition()
INTERNAL: Return the position of the stream inside the object collection.
-
getQuery
public ReadQuery getQuery()
INTERNAL: Return the query associated with the stream.
-
getResultSet
public ResultSet getResultSet()
INTERNAL: Return the result set (cursor).
-
getSelectionCriteriaClone
public Expression getSelectionCriteriaClone()
INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.
-
getSession
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
INTERNAL: Return the handle to the session
-
getExecutionSession
public org.eclipse.persistence.internal.sessions.AbstractSession getExecutionSession()
INTERNAL: Returns the session the underlying call was executed on. This root session knows the database platform.
-
isClosed
public boolean isClosed()
PUBLIC: Return if the stream is closed.
-
setInitiallyConformingIndex
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.
-
setObjectCollection
public void setObjectCollection(List<Object> collection)
INTERNAL: Set the internal object collection
-
setPolicy
public void setPolicy(CursorPolicy policy)
INTERNAL: Set the cursor policy.
-
setSelectionCriteriaClone
public void setSelectionCriteriaClone(Expression expression)
INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.
-
setSession
public void setSession(org.eclipse.persistence.internal.sessions.AbstractSession databaseSession)
INTERNAL: Set the session handle
-
setSize
public void setSize(int size)
INTERNAL: Set the cache size
-
setTranslationRow
public void setTranslationRow(org.eclipse.persistence.internal.sessions.AbstractRecord row)
INTERNAL: Sets the translation row this query was executed with. Used for incremental conforming.
-
size
public int size() throws DatabaseExceptionPUBLIC: 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.- Throws:
DatabaseException
-
remove
public void remove() throws QueryExceptionPUBLIC: Remove is not support with cursors.- Specified by:
removein interfaceIterator- Throws:
QueryException
-
clear
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.
-
-