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
| Modifier and Type | Class and Description |
|---|---|
| public static enum | ReadAllQuery.Direction
Specifies the direction in which the hierarchy is traversed in a hierarchical query. |
| Modifier and Type | Field and Description |
|---|---|
| protected Expression | |
| protected ContainerPolicy | containerPolicy
Used for collection and stream support. |
| protected ReadAllQuery. | |
| protected List | |
| protected Expression | startWithExpression
Used for Oracle HierarchicalQuery support |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | ReadAllQuery(Class<?> classToRead, Expression selectionCriteria)
PUBLIC: Return a new read all query for the class and the selection criteria. |
| public | ReadAllQuery(Class<?> classToRead, ExpressionBuilder builder)
PUBLIC: Return a new read all query for the class. |
| public | |
| public | ReadAllQuery(Object exampleObject, QueryByExamplePolicy policy)
PUBLIC: Return a query by example query to find all objects matching the attributes of the example object. |
| public | ReadAllQuery(ExpressionBuilder builder)
PUBLIC: The expression builder should be provide on creation to ensure only one is used. |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addAscendingOrdering(String queryKeyName)
PUBLIC: Order the query results by the object's attribute or query key name. |
| public void | cacheResult(Object unwrappedOriginal)
Implements abstract org. This method is called by the object builder when building an original. |
| protected Boolean | Returns: Current custom query flag. Value will never benull.Current session (not used). session, final AbstractRecord Database record (not used). translationRow)Implements abstract org. |
| protected Object | checkEarlyReturnLocal(AbstractSession session, AbstractRecord translationRow)
Implements abstract org. |
| public Object | Returns: A clone of this instance.Overrides org. |
| protected Object | conformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows)
INTERNAL: Conform the result if specified. |
| public boolean | equals(Object
the reference object with which to compare. object)Overrides org. |
| public Object | Returns: An object or vector, the result of executing the query.- the session in which the receiver will be executed. session, AbstractRecord row)Overrides org. |
| protected Object | Returns: java.lang.Object collection of objects resulting from execution of query.Implements abstract org. |
| protected Object | Returns: an ArrayList of the resulting objects.Implements abstract org. |
| public Object | extractRemoteResult(Transporter transporter)
Overrides org. |
| public Expression | Returns: Expression - the connect by expression used to generate the hierarchical query caluse in OraclePUBLIC: |
| public ContainerPolicy | |
| protected QueryRedirector | getDefaultRedirector()
Overrides org. |
| public ReadAllQuery. | |
| public List | Returns: List<Expression> - the ordering expressions used to generate the hierarchical query clause in OraclePUBLIC: |
| protected ObjectLevelReadQuery | Returns: Custom all read query from query manager.Implements abstract org. |
| public Expression | Returns: Expression - the start with expression used to generated the hierarchical query clause in OraclePUBLIC: |
| public boolean | |
| public boolean | isDefaultPropertiesQuery()
Overrides org. |
| public boolean | isReadAllQuery()
Overrides org. |
| protected void | prepare()
Overrides org. |
| protected void | prepareCustomQuery(DatabaseQuery customQuery)
Overrides org. |
| public void | prepareForExecution()
Overrides org. |
| public void | prepareFromQuery(DatabaseQuery query)
Overrides org. |
| protected void | |
| public Object | Returns: the final (conformed, refreshed, wrapped) UnitOfWork query resultmay be collection (read all) or an object (read one),
or even a cursor. If in transaction the shared cache will
be bypassed, meaning the result may not be originals from the parent
but raw database rows. result, UnitOfWorkImpl the unitOfWork the result is being registered in. unitOfWork, AbstractRecord the original arguments/parameters passed to the query
execution. Used by conforming arguments, boolean If in transaction must construct
a registered result from raw database rows. buildDirectlyFromRows)Implements abstract org. |
| public Object | Returns: the final (conformed, refreshed, wrapped) UnitOfWork query resultINTERNAL: Version of the previous method for ResultSet optimization. |
| public Object | remoteExecute()
Overrides org. |
| public Map | replaceValueHoldersIn(Object object, RemoteSessionController controller)
Overrides org. |
| public void | |
| public void | setHierarchicalQueryClause(Expression
Describes the START WITH clause of the query - null if not needed startWith, Expression This should be a query key expression which indicates an attribute who's mapping describes the hierarchy connectBy, List<Expression> Contains expressions which indicate fields to be included in the ORDER SIBLINGS BY clause - null if not required orderSiblingsExpressions)PUBLIC: Set the Hierarchical Query Clause for the query Example: Expression startWith = builder.get("id").equal(Integer.valueOf(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 |
| public void | setHierarchicalQueryClause(Expression
Describes the START WITH clause of the query - null if not
needed startWith, Expression This should be a query key expression which indicates an
attribute who's mapping describes the hierarchy connectBy, List<Expression> Contains expressions which indicate fields to be included in
the ORDER SIBLINGS BY clause - null if not required orderSiblingsExpressions, ReadAllQuery.The direction in which the hierarchy is traversed; if not
specified, CHILD_TO_PARENT is used for OneToOne relationships
and PARENT_TO_CHILD is used for collections directionPUBLIC: Set the Hierarchical Query Clause for the query, specifying the hierarchy traversal direction Example: Expression startWith = builder.get("id").equal(Integer.valueOf(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, Direction.CHILD_TO_PARENT); This query would generate SQL like this: SELECT * FROM EMPLOYEE START WITH ID=100 CONNECT BY ID = PRIOR MANAGER_ID ORDER SIBLINGS BY START_DATE |
| public boolean | supportsResultSetAccessOptimizationOnExecute()
Overrides org. |
| public boolean | supportsResultSetAccessOptimizationOnPrepare()
Overrides org. |
| public void | useCollectionClass(Class<?> concreteClass)
PUBLIC: Configure the mapping to use an instance of the specified container class to hold the target objects. |
| public void | |
| public void | useCursoredStream(int
the initial number of objects to read initialReadSize, int the number of objects to read when more objects
are needed from the database pageSize)PUBLIC: Use a CursoredStream as the result collection. |
| public void | useCursoredStream(int
the initial number of objects to read initialReadSize, int the number of objects to read when more objects
are needed from the database pageSize, ValueReadQuery 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) sizeQuery)PUBLIC: Use a CursoredStream as the result collection. |
| public void | useMapClass(Class<?> concreteClass, String methodName)
PUBLIC: Configure the query to use an instance of the specified container class to hold the result objects. |
| public void | |
| public void | useScrollableCursor(int
the number of elements to be read into a the cursor
when more elements are needed from the database. pageSize)PUBLIC: Use a ScrollableCursor as the result collection. |
| public void | useScrollableCursor(ScrollableCursorPolicy
the scrollable cursor policy allows for additional result set options.
Example: policy)ScrollableCursorPolicy policy = new ScrollableCursorPolicy() policy.setResultSetType(ScrollableCursorPolicy.TYPE_SCROLL_INSENSITIVE); query.useScrollableCursor(policy); PUBLIC: Use a ScrollableCursor as the result collection. |