|
Oracle Fusion Middleware Java API Reference for Oracle TopLink 11g Release 1 (11.1.1) B32476-03 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.toplink.queryframework.DatabaseQuery oracle.toplink.queryframework.ReadQuery oracle.toplink.queryframework.ObjectBuildingQuery oracle.toplink.queryframework.ObjectLevelReadQuery oracle.toplink.queryframework.ReadAllQuery
public class ReadAllQuery
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
Field Summary |
---|
Fields inherited from class oracle.toplink.queryframework.ObjectLevelReadQuery |
---|
CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, DoNotCheckCache, DONT_USE_DISTINCT, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting |
Fields inherited from class oracle.toplink.queryframework.ObjectBuildingQuery |
---|
DEFAULT_LOCK_MODE, LOCK, LOCK_NOWAIT, NO_LOCK |
Fields inherited from class oracle.toplink.queryframework.DatabaseQuery |
---|
CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, CascadePrivateParts, NoCascading |
Constructor Summary | |
---|---|
ReadAllQuery()
Return a new read all query. |
|
ReadAllQuery(Call call)
Create a read all query with the database call. |
|
ReadAllQuery(java.lang.Class classToRead)
Return a new read all query. |
|
ReadAllQuery(java.lang.Class classToRead,
Call call)
Return a new read all query. |
|
ReadAllQuery(java.lang.Class classToRead,
Expression selectionCriteria)
Return a new read all query for the class and the selection criteria. |
|
ReadAllQuery(java.lang.Class classToRead,
ExpressionBuilder builder)
Return a new read all query for the class. |
|
ReadAllQuery(ExpressionBuilder builder)
The expression builder should be provide on creation to ensure only one is used. |
|
ReadAllQuery(java.lang.Object exampleObject,
QueryByExamplePolicy policy)
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)
Order the query results by the object's attribute or query key name. |
void |
addBatchReadAttribute(Expression attributeExpression)
Specify the foreign-reference mapped attribute to be optimized in this query. |
void |
addBatchReadAttribute(java.lang.String attributeName)
Specify the foreign-reference mapped attribute to be optimized in this query. |
void |
addDescendingOrdering(java.lang.String queryKeyName)
Order the query results by the object's attribute or query key name. |
void |
addOrdering(Expression orderingExpression)
Add the ordering expression. |
Expression |
getConnectByExpression()
|
java.util.Vector |
getOrderSiblingsByExpressions()
|
Expression |
getStartWithExpression()
|
boolean |
isReadAllQuery()
Return if this is a read all query. |
void |
setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
Set the container policy. |
void |
setHierarchicalQueryClause(Expression startWith,
Expression connectBy,
java.util.Vector orderSiblingsExpressions)
Set the Hierarchical Query Clause for the query Example: Expression startWith = builder.get("id").equal(new Integer(100)); //can be any expression which identifies a set of employees Expression connectBy = builder.get("managedEmployees"); //indicated the relationship that the hierarchy is based on, must be self-referential Vector orderBy = new Vector(); orderBy.addElement(builder.get("startDate")); readAllQuery.setHierarchicalQueryClause(startWith, connectBy, orderBy); This query would generate SQL like this: SELECT * FROM EMPLOYEE START WITH ID=100 CONNECT BY PRIOR ID = MANAGER_ID ORDER SIBLINGS BY START_DATE |
void |
useCollectionClass(java.lang.Class concreteClass)
Configure the mapping to use an instance of the specified container class to hold the target objects. |
void |
useCursoredStream()
Use a CursoredStream as the result collection. |
void |
useCursoredStream(int initialReadSize,
int pageSize)
Use a CursoredStream as the result collection. |
void |
useCursoredStream(int initialReadSize,
int pageSize,
ValueReadQuery sizeQuery)
Use a CursoredStream as the result collection. |
void |
useMapClass(java.lang.Class concreteClass,
java.lang.String methodName)
Configure the query to use an instance of the specified container class to hold the result objects. |
void |
useScrollableCursor()
Use a ScrollableCursor as the result collection. |
void |
useScrollableCursor(int pageSize)
Use a ScrollableCursor as the result collection. |
void |
useScrollableCursor(ScrollableCursorPolicy policy)
Use a ScrollableCursor as the result collection. |
Methods inherited from class oracle.toplink.queryframework.ObjectBuildingQuery |
---|
isObjectBuildingQuery, setShouldUseExclusiveConnection, shouldUseExclusiveConnection |
Methods inherited from class oracle.toplink.queryframework.ReadQuery |
---|
cacheQueryResults, clearQueryResults, clearQueryResults, doNotCacheQueryResults, getFetchSize, getFirstResult, getMaxRows, getQueryResultsCachePolicy, isReadQuery, setFetchSize, setFirstResult, setMaxRows, setQueryResultsCachePolicy, setShouldCacheQueryResults, shouldCacheQueryResults |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ReadAllQuery()
public ReadAllQuery(java.lang.Class classToRead)
public ReadAllQuery(java.lang.Class classToRead, Expression selectionCriteria)
public ReadAllQuery(java.lang.Class classToRead, ExpressionBuilder builder)
public ReadAllQuery(java.lang.Class classToRead, Call call)
public ReadAllQuery(java.lang.Object exampleObject, QueryByExamplePolicy policy)
public ReadAllQuery(ExpressionBuilder builder)
public ReadAllQuery(Call call)
Method Detail |
---|
public void addAscendingOrdering(java.lang.String queryKeyName)
public void addBatchReadAttribute(java.lang.String attributeName)
Example: query.addBatchReadAttribute("phoneNumbers")
addBatchReadAttribute(Expression)
,
ObjectLevelReadQuery.addJoinedAttribute(String)
public void addBatchReadAttribute(Expression attributeExpression)
Example: query.addBatchReadAttribute(query.getExpressionBuilder().get("policies").get("claims"))
ObjectLevelReadQuery.addJoinedAttribute(String)
public void addDescendingOrdering(java.lang.String queryKeyName)
public void addOrdering(Expression orderingExpression)
public Expression getStartWithExpression()
public Expression getConnectByExpression()
public java.util.Vector getOrderSiblingsByExpressions()
public boolean isReadAllQuery()
isReadAllQuery
in class DatabaseQuery
public void setContainerPolicy(oracle.toplink.internal.queryframework.ContainerPolicy containerPolicy)
public void setHierarchicalQueryClause(Expression startWith, Expression connectBy, java.util.Vector orderSiblingsExpressions)
Example:
Expression startWith = builder.get("id").equal(new Integer(100)); //can be any expression which identifies a set of employees
Expression connectBy = builder.get("managedEmployees"); //indicated the relationship that the hierarchy is based on, must be self-referential
Vector orderBy = new Vector();
orderBy.addElement(builder.get("startDate"));
readAllQuery.setHierarchicalQueryClause(startWith, connectBy, orderBy);
This query would generate SQL like this:
SELECT * FROM EMPLOYEE START WITH ID=100 CONNECT BY PRIOR ID = MANAGER_ID ORDER SIBLINGS BY START_DATE
startWith
- Describes the START WITH clause of the query - null if not neededconnectBy
- This should be a query key expression which indicates an attribute who's mapping describes the hierarchyorderSiblingsExpressions
- Contains expressions which indicate fields to be included in the ORDER SIBLINGS BY clause - null if not requiredpublic void useCollectionClass(java.lang.Class concreteClass)
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.
public void useCursoredStream()
public void useCursoredStream(int initialReadSize, int pageSize)
initialReadSize
- the initial number of objects to readpageSize
- the number of objects to read when more objects
are needed from the databasepublic void useCursoredStream(int initialReadSize, int pageSize, ValueReadQuery sizeQuery)
initialReadSize
- the initial number of objects to readpageSize
- the number of objects to read when more objects
are needed from the databasesizeQuery
- 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)public void useMapClass(java.lang.Class concreteClass, java.lang.String methodName)
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.
public void useScrollableCursor()
public void useScrollableCursor(int pageSize)
pageSize
- the number of elements to be read into a the cursor
when more elements are needed from the database.public void useScrollableCursor(ScrollableCursorPolicy policy)
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);
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |