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
Purpose: Abstract class for CursoredStream and ScrolableCursor
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.eclipse.persistence.internal.sessions.AbstractSession
The root session that executed the call for the query.protected Vector<org.eclipse.persistence.internal.helper.DatabaseField>
The fields expected in the result set.Conforming instances found in memory when building the result.protected org.eclipse.persistence.internal.sessions.AbstractRecord
Store the next row, for 1-m joining.Internal collection of objects.Query policy that initialize the stream.protected int
Current position in the objectCollection of the stream.Read query that initialize the stream.protected ResultSet
The result set (cursor) that holds the handle to the database that the results are read from.protected Expression
SelectionCriteria & translation row ready for incremental conforming.protected org.eclipse.persistence.internal.sessions.AbstractSession
The session that executed the query for the stream.protected int
Cached size of the stream.protected Statement
The preparedStatement that holds the handle to the database that the results are read from.protected org.eclipse.persistence.internal.sessions.AbstractRecord
-
Constructor Summary
ConstructorDescriptionCursor()
INTERNAL: Default constructor.Cursor
(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, CursorPolicy policy) INTERNAL: -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
buildAndRegisterObject
(org.eclipse.persistence.internal.sessions.AbstractRecord row) INTERNAL: builds and registers an object from a row for cursors.void
clear()
PUBLIC: Release all objects read in so far.void
close()
PUBLIC: Closes the stream.protected void
finalize()
Close in case not closed.org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor
INTERNAL: Return the accessor associated with the cursor.protected abstract int
INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.org.eclipse.persistence.internal.sessions.AbstractSession
INTERNAL: Returns the session the underlying call was executed on.Vector<org.eclipse.persistence.internal.helper.DatabaseField>
INTERNAL: Return the fields for the stream.INTERNAL: Conforming instances found in memory when building the result.INTERNAL: Return the internal object collection that stores the objects.int
INTERNAL: Return the number of items to be faulted in for the stream.INTERNAL: Return the cursor policy.abstract int
INTERNAL: Return the position of the stream inside the object collection.getQuery()
INTERNAL: Return the query associated with the stream.INTERNAL: Return the result set (cursor).INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.org.eclipse.persistence.internal.sessions.AbstractSession
INTERNAL: Return the handle to the sessionprotected Statement
INTERNAL: Return the Statement.protected org.eclipse.persistence.internal.sessions.AbstractRecord
INTERNAL: Gets the translation row the query was executed with, used for incremental conforming.boolean
isClosed()
PUBLIC: Return if the stream is closed.void
remove()
PUBLIC: Remove is not support with cursors.protected abstract Object
INTERNAL: Read the next row from the result set.protected void
setExecutionSession
(org.eclipse.persistence.internal.sessions.AbstractSession executionSession) INTERNAL: Sets the session the underlying call was executed on.protected void
INTERNAL: Set the fields for the stream.void
setInitiallyConformingIndex
(Map<Object, Object> index) INTERNAL: Conforming instances found in memory when building the result.void
setObjectCollection
(List<Object> collection) INTERNAL: Set the internal object collectionvoid
setPolicy
(CursorPolicy policy) INTERNAL: Set the cursor policy.protected void
setPosition
(int value) INTERNAL: Set the current position of the streamprotected void
setResultSet
(ResultSet result) INTERNAL: Set the result set (cursor)void
setSelectionCriteriaClone
(Expression expression) INTERNAL: The clone of the selection criteria is needed for in-memory conforming each object read from the Cursor.void
setSession
(org.eclipse.persistence.internal.sessions.AbstractSession databaseSession) INTERNAL: Set the session handlevoid
setSize
(int size) INTERNAL: Set the cache sizevoid
setTranslationRow
(org.eclipse.persistence.internal.sessions.AbstractRecord row) INTERNAL: Sets the translation row this query was executed with.int
size()
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
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
Field Details
-
statement
The preparedStatement that holds the handle to the database that the results are read from. -
resultSet
The result set (cursor) that holds the handle to the database that the results are read from. -
session
protected transient org.eclipse.persistence.internal.sessions.AbstractSession sessionThe session that executed the query for the stream. -
executionSession
protected transient org.eclipse.persistence.internal.sessions.AbstractSession executionSessionThe root session that executed the call for the query. Knows the database platform. -
fields
The fields expected in the result set. -
size
protected int sizeCached size of the stream. -
query
Read query that initialize the stream. -
policy
Query policy that initialize the stream. -
objectCollection
Internal collection of objects. -
initiallyConformingIndex
Conforming instances found in memory when building the result. -
selectionCriteriaClone
SelectionCriteria & translation row ready for incremental conforming. -
translationRow
protected org.eclipse.persistence.internal.sessions.AbstractRecord translationRow -
nextRow
protected org.eclipse.persistence.internal.sessions.AbstractRecord nextRowStore the next row, for 1-m joining. -
position
protected int positionCurrent position in the objectCollection of the stream.
-
-
Constructor Details
-
Cursor
public Cursor()INTERNAL: Default constructor. -
Cursor
public Cursor(org.eclipse.persistence.internal.databaseaccess.DatabaseCall call, CursorPolicy policy) INTERNAL:
-
-
Method Details
-
close
PUBLIC: Closes the stream. This should be performed whenever the user has finished with the stream.- Throws:
DatabaseException
-
finalize
Close in case not closed.- Overrides:
finalize
in classObject
- Throws:
DatabaseException
-
getAccessor
public org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor getAccessor()INTERNAL: Return the accessor associated with the cursor. -
getCursorSize
INTERNAL: Retrieve the size of the open cursor by executing a count on the same query as the cursor.- Throws:
DatabaseException
QueryException
-
getFields
INTERNAL: Return the fields for the stream. -
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
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
INTERNAL: Return the cursor policy. -
getPosition
public abstract int getPosition()INTERNAL: Return the position of the stream inside the object collection. -
getQuery
INTERNAL: Return the query associated with the stream. -
getResultSet
INTERNAL: Return the result set (cursor). -
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. -
getStatement
INTERNAL: Return the Statement. -
getTranslationRow
protected org.eclipse.persistence.internal.sessions.AbstractRecord getTranslationRow()INTERNAL: Gets the translation row the query was executed with, used for incremental conforming. -
isClosed
public boolean isClosed()PUBLIC: Return if the stream is closed. -
buildAndRegisterObject
protected Object buildAndRegisterObject(org.eclipse.persistence.internal.sessions.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. -
retrieveNextObject
INTERNAL: Read the next row from the result set.- Throws:
DatabaseException
-
setFields
INTERNAL: Set the fields for the stream. -
setInitiallyConformingIndex
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
INTERNAL: Set the internal object collection -
setPolicy
INTERNAL: Set the cursor policy. -
setPosition
protected void setPosition(int value) INTERNAL: Set the current position of the stream -
setResultSet
INTERNAL: Set the result set (cursor) -
setSelectionCriteriaClone
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 -
setExecutionSession
protected void setExecutionSession(org.eclipse.persistence.internal.sessions.AbstractSession executionSession) INTERNAL: Sets the session the underlying call was executed on. This root session knows the database platform. -
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: 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: Remove is not support with cursors.- Specified by:
remove
in 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.
-