Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.queryframework
Class ReadAllQuery

java.lang.Object
  extended byoracle.toplink.queryframework.DatabaseQuery
      extended byoracle.toplink.queryframework.ReadQuery
          extended byoracle.toplink.queryframework.ObjectLevelReadQuery
              extended byoracle.toplink.queryframework.ReadAllQuery

All Implemented Interfaces:
java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue, java.io.Serializable
Direct Known Subclasses:
ReportQuery

public class ReadAllQuery
extends ObjectLevelReadQuery

Purpose: Concrete class for all read queries involving a collection of objects.

Responsibilities: Return a container of the objects generated by the query. Implements the inheritance feature when dealing with abstract descriptors

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Field Summary

Fields inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery
CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, DoNotCheckCache, DONT_USE_DISTINCT, inMemoryQueryIndirectionPolicy, LOCK, LOCK_NOWAIT, NO_LOCK, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting

Fields inherited from class oracle.toplink.queryframework.DatabaseQuery
CascadeAggregateDelete, CascadeAllParts, CascadeDependentParts, CascadePrivateParts, NoCascading, QUERY_PREPARE

Constructor Summary
ReadAllQuery()
PUBLIC: Return a new read all query.
ReadAllQuery(java.lang.Class classToRead)
PUBLIC: Return a new read all query.
ReadAllQuery(java.lang.Class classToRead, Call call)
PUBLIC: Return a new read all query.
ReadAllQuery(java.lang.Class classToRead, Expression selectionCriteria)
PUBLIC: Return a new read all query for the class and the selection criteria.
ReadAllQuery(java.lang.Class classToRead, ExpressionBuilder builder)
PUBLIC: Return a new read all query for the class.
ReadAllQuery(ExpressionBuilder builder)
PUBLIC: The expression builder should be provide on creation to ensure only one is used.
ReadAllQuery(java.lang.Object exampleObject, QueryByExamplePolicy policy)
PUBLIC: Return a query by example query to find all objects matching the attributes of the example object.

Method Summary
void addAscendingOrdering(java.lang.String queryKeyName)
PUBLIC: Order the query results by the object's attribute or query key name.
void addBatchReadAttribute(Expression attributeExpression)
PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query.
void addBatchReadAttribute(java.lang.String attributeName)
PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query.
void addDescendingOrdering(java.lang.String queryKeyName)
PUBLIC: Order the query results by the object's attribute or query key name.
void addOrdering(Expression orderingExpression)
PUBLIC: Add the ordering expression.
void dontUseCursoredStream()
Deprecated.
Expression getConnectByExpression()
PUBLIC:
int getCursorPageAmount()
Deprecated.
int getCursorThreshold()
Deprecated.
java.util.Vector getOrderSiblingsByExpressions()
PUBLIC:
Expression getStartWithExpression()
PUBLIC:
boolean isReadAllQuery()
PUBLIC: Return if this is a read all query.
java.lang.Object remoteExecute()
void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
PUBLIC: Set the container policy.
void setCursorPageAmount(int pageAmount)
Deprecated.
void setCursorThreshold(int threshold)
Deprecated.
void setHierarchicalQueryClause(Expression startWith, Expression connectBy, java.util.Vector orderSiblingsExpressions)
PUBLIC: Set the Hierarchical Query Clause for the query
void setUsesCursoredStream(boolean usesCursoredStream)
Deprecated.
void useCollectionClass(java.lang.Class concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.
void useCursoredStream()
PUBLIC: Use a CursoredStream as the result collection.
void useCursoredStream(int initialReadSize, int pageSize)
PUBLIC: Use a CursoredStream as the result collection.
void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery)
PUBLIC: Use a CursoredStream as the result collection.
void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
PUBLIC: Configure the query to use an instance of the specified container class to hold the result objects.
void useScrollableCursor()
PUBLIC: Use a ScrollableCursor as the result collection.
void useScrollableCursor(int pageSize)
PUBLIC: Use a ScrollableCursor as the result collection.
void useScrollableCursor(ScrollableCursorPolicy policy)
PUBLIC: Use a ScrollableCursor as the result collection.

Methods inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery
acquireLocks, acquireLocksWithoutWaiting, addJoinedAttribute, addJoinedAttribute, addPartialAttribute, addPartialAttribute, checkCacheOnly, conformResultsInUnitOfWork, dontAcquireLocks, dontCheckCache, dontRefreshIdentityMapResult, dontRefreshRemoteIdentityMapResult, dontUseDistinct, getCacheUsage, getDistinctState, getExampleObject, getExpressionBuilder, getInMemoryQueryIndirectionPolicy, getLockMode, getQueryByExamplePolicy, getReferenceClass, hasJoinedMappings, isLockQuery, isObjectLevelReadQuery, refreshIdentityMapResult, refreshRemoteIdentityMapResult, resetDistinct, setCacheUsage, setDistinctState, setExampleObject, setInMemoryQueryIndirectionPolicy, setLockMode, setQueryByExamplePolicy, setReferenceClass, setShouldRefreshIdentityMapResult, setShouldRefreshRemoteIdentityMapResult, shouldCheckCacheOnly, shouldCheckDescriptorForCacheUsage, shouldConformResultsInUnitOfWork, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, toString, useDistinct

Methods inherited from class oracle.toplink.queryframework.ReadQuery
cacheQueryResults, clearQueryResults, doNotCacheQueryResults, getMaxRows, isReadQuery, setMaxRows, setShouldCacheQueryResults, shouldCacheQueryResults

Methods inherited from class oracle.toplink.queryframework.DatabaseQuery
addArgument, addArgument, addArgument, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, cacheStatement, cascadeAllParts, cascadePrivateParts, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getCall, getEJBQLString, getHintString, getName, getQueryTimeout, getRedirector, getSelectionCriteria, getSessionName, getSQLStatement, getSQLString, getTranslatedSQLString, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isDataModifyQuery, isDataReadQuery, isDeleteObjectQuery, isExpressionQuery, isModifyQuery, isObjectLevelModifyQuery, isReadObjectQuery, isReportQuery, isSQLCallQuery, isWriteObjectQuery, maintainCache, prepareCall, setCall, setEJBQLString, setHintString, setName, setQueryTimeout, setRedirector, setSelectionCriteria, setSessionName, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeParts, shouldCascadePrivateParts, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

ReadAllQuery

public ReadAllQuery()
PUBLIC: Return a new read all query. A reference class must be specified before execution. It is better to provide the class and expression builder on construction to esnure a single expression builder is used. If no selection criteria is specified this will read all objects of the class from the database.

ReadAllQuery

public ReadAllQuery(java.lang.Class classToRead)
PUBLIC: Return a new read all query. It is better to provide the class and expression builder on construction to esnure a single expression builder is used. If no selection criteria is specified this will read all objects of the class from the database.

ReadAllQuery

public ReadAllQuery(java.lang.Class classToRead,
                    Expression selectionCriteria)
PUBLIC: Return a new read all query for the class and the selection criteria.

ReadAllQuery

public ReadAllQuery(java.lang.Class classToRead,
                    ExpressionBuilder builder)
PUBLIC: Return a new read all query for the class. The expression builder must be used for all associated expressions used with the query.

ReadAllQuery

public ReadAllQuery(java.lang.Class classToRead,
                    Call call)
PUBLIC: Return a new read all query. The call represents a database interaction such as SQL, Stored Procedure.

ReadAllQuery

public ReadAllQuery(java.lang.Object exampleObject,
                    QueryByExamplePolicy policy)
PUBLIC: Return a query by example query to find all objects matching the attributes of the example object.

ReadAllQuery

public ReadAllQuery(ExpressionBuilder builder)
PUBLIC: The expression builder should be provide on creation to ensure only one is used.

Method Detail

addAscendingOrdering

public void addAscendingOrdering(java.lang.String queryKeyName)
PUBLIC: Order the query results by the object's attribute or query key name.

addBatchReadAttribute

public void addBatchReadAttribute(java.lang.String attributeName)
PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query. The query will execute normally, however when any of the batched parts is accessed, the parts will all be read in a single query, this allows all of the data required for the parts to be read in a single query instead of (n) queries. This should be used when the application knows that it requires the part for all of the objects being read. This can be used for one-to-one, one-to-many, many-to-many and direct collection mappings. The use of the expression allows for nested batch reading to be expressed.

Example: query.addBatchReadAttribute("phoneNumbers")

See Also:
addBatchReadAttribute(Expression), ObjectLevelReadQuery.addJoinedAttribute(String)

addBatchReadAttribute

public void addBatchReadAttribute(Expression attributeExpression)
PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query. The query will execute normally, however when any of the batched parts is accessed, the parts will all be read in a single query, this allows all of the data required for the parts to be read in a single query instead of (n) queries. This should be used when the application knows that it requires the part for all of the objects being read. This can be used for one-to-one, one-to-many, many-to-many and direct collection mappings. The use of the expression allows for nested batch reading to be expressed.

Example: query.addBatchReadAttribute(query.getExpressionBuilder().get("policies").get("claims"))

See Also:
ObjectLevelReadQuery.addJoinedAttribute(String)

addDescendingOrdering

public void addDescendingOrdering(java.lang.String queryKeyName)
PUBLIC: Order the query results by the object's attribute or query key name.

addOrdering

public void addOrdering(Expression orderingExpression)
PUBLIC: Add the ordering expression. This allows for ordering across relationships or functions. Example: readAllQuery.addOrdering(expBuilder.get("address").get("city").toUpperCase().descending())

dontUseCursoredStream

public void dontUseCursoredStream()
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

getCursorPageAmount

public int getCursorPageAmount()
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

getCursorThreshold

public int getCursorThreshold()
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

getStartWithExpression

public Expression getStartWithExpression()
PUBLIC:
Returns:
Expression - the start with expression used to generated the hierarchical query clause in Oracle

getConnectByExpression

public Expression getConnectByExpression()
PUBLIC:
Returns:
Expression - the connect by expression used to generate the hierarchical query caluse in Oracle

getOrderSiblingsByExpressions

public java.util.Vector getOrderSiblingsByExpressions()
PUBLIC:
Returns:
Vector - the ordering expressions used to generate the hierarchical query clause in Oracle

isReadAllQuery

public boolean isReadAllQuery()
PUBLIC: Return if this is a read all query.
Overrides:
isReadAllQuery in class DatabaseQuery

remoteExecute

public java.lang.Object remoteExecute()

setContainerPolicy

public void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
PUBLIC: Set the container policy. Used to support different containers (e.g. Collections, Maps).

setCursorPageAmount

public void setCursorPageAmount(int pageAmount)
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

setCursorThreshold

public void setCursorThreshold(int threshold)
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

setHierarchicalQueryClause

public void setHierarchicalQueryClause(Expression startWith,
                                       Expression connectBy,
                                       java.util.Vector orderSiblingsExpressions)
PUBLIC: Set the Hierarchical Query Clause for the query

setUsesCursoredStream

public void setUsesCursoredStream(boolean usesCursoredStream)
Deprecated.
OBSOLETE:
See Also:
useCursoredStream(int, int)

useCollectionClass

public void useCollectionClass(java.lang.Class concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects.

jdk1.2.x: The container class must implement (directly or indirectly) the Collection interface.

jdk1.1.x: The container class must be a subclass of Vector.


useCursoredStream

public void useCursoredStream()
PUBLIC: Use a CursoredStream as the result collection. The initial read size is 10 and page size is 5.

useCursoredStream

public void useCursoredStream(int initialReadSize,
                              int pageSize)
PUBLIC: Use a CursoredStream as the result collection.
Parameters:
initialReadSize - the initial number of objects to read
pageSize - the number of objects to read when more objects are needed from the database

useCursoredStream

public void useCursoredStream(int initialReadSize,
                              int pageSize,
                              ValueReadQuery sizeQuery)
PUBLIC: Use a CursoredStream as the result collection.
Parameters:
initialReadSize - the initial number of objects to read
pageSize - the number of objects to read when more objects are needed from the database
sizeQuery - a query that will return the size of the result set; this must be set if an expression is not used (i.e. custom SQL)

useMapClass

public void useMapClass(java.lang.Class concreteClass,
                        java.lang.String methodName)
PUBLIC: Configure the query to use an instance of the specified container class to hold the result objects. The key used to index the value in the Map is the value returned by a call to the specified zero-argument method. The method must be implemented by the class (or a superclass) of the value to be inserted into the Map.

jdk1.2.x: The container class must implement (directly or indirectly) the Map interface.

jdk1.1.x: The container class must be a subclass of Hashtable.

The referenceClass must set before calling this method.


useScrollableCursor

public void useScrollableCursor()
PUBLIC: Use a ScrollableCursor as the result collection.

useScrollableCursor

public void useScrollableCursor(int pageSize)
PUBLIC: Use a ScrollableCursor as the result collection.
Parameters:
pageSize - the number of elements to be read into a the cursor when more elements are needed from the database.

useScrollableCursor

public void useScrollableCursor(ScrollableCursorPolicy policy)
PUBLIC: Use a ScrollableCursor as the result collection.
Parameters:
policy - the scrollable cursor policy allows for additional result set options. Example:

ScrollableCursorPolicy policy = new ScrollableCursorPolicy()

policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_INSENSITIVE);

query.useScrollableCursor(policy);


Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.