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
Modifier and Type | Field and Description |
---|---|
protected ContainerPolicy |
containerPolicy
Used for collection and stream support.
|
protected Vector |
orderByExpressions
Used for ordering support.
|
additionalFields, cacheUsage, CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, ConformResultsInUnitOfWork, defaultBuilder, distinctState, DoNotCheckCache, DONT_USE_DISTINCT, executionTime, fetchGroup, fetchGroupName, inMemoryQueryIndirectionPolicy, joinedAttributeManager, LOCK_RESULT_PROPERTY, nonFetchJoinAttributeExpressions, shouldIncludeData, shouldProcessResultsInUnitOfWork, shouldRefreshIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseDefaultFetchGroup, UNCOMPUTED_DISTINCT, USE_DISTINCT, UseDescriptorSetting, wasDefaultLockMode
DEFAULT_LOCK_MODE, isPrePrepared, LOCK, LOCK_NOWAIT, lockingClause, NO_LOCK, referenceClass, referenceClassName, shouldRefreshRemoteIdentityMapResult, shouldUseExclusiveConnection
firstResult, maxRows, queryId
accessor, arguments, argumentTypeNames, argumentTypes, argumentValues, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, cascadePolicy, CascadePrivateParts, descriptor, flushOnExecute, isPrepared, isUserDefined, name, NoCascading, properties, queryMechanism, session, sessionName, shouldBindAllParameters, shouldCacheStatement, shouldCloneCall, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy, translationRow
False, True, Undefined
Constructor and Description |
---|
ReadAllQuery()
PUBLIC:
Return a new read all query.
|
ReadAllQuery(Call call)
PUBLIC:
Create a read all query with the database call.
|
ReadAllQuery(Class classToRead)
PUBLIC:
Return a new read all query.
|
ReadAllQuery(Class classToRead,
Call call)
PUBLIC:
Return a new read all query.
|
ReadAllQuery(Class classToRead,
Expression selectionCriteria)
PUBLIC:
Return a new read all query for the class and the selection criteria.
|
ReadAllQuery(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.
|
Modifier and Type | Method and Description |
---|---|
void |
addAscendingOrdering(String queryKeyName)
PUBLIC:
Order the query results by the object's attribute or query key name.
|
void |
addDescendingOrdering(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.
|
protected Object |
checkEarlyReturnImpl(AbstractSession session,
AbstractRecord translationRow)
INTERNAL:
The cache check is done before the prepare as a hit will not require the work to be done.
|
protected DatabaseQuery |
checkForCustomQuery(AbstractSession session,
AbstractRecord translationRow)
INTERNAL:
Check to see if a custom query should be used for this query.
|
Object |
clone()
INTERNAL:
Clone the query.
|
protected Object |
conformResult(Object result,
UnitOfWorkImpl unitOfWork,
AbstractRecord arguments,
boolean buildDirectlyFromRows)
INTERNAL:
Conform the result if specified.
|
protected Object |
executeObjectLevelReadQuery()
INTERNAL:
Execute the query.
|
ContainerPolicy |
getContainerPolicy()
INTERNAL:
Return the query's container policy.
|
Vector |
getOrderByExpressions()
INTERNAL:
Return the order expressions for the query.
|
boolean |
hasBatchReadAttributes()
INTERNAL:
Return true is this query has batching
|
boolean |
hasHierarchicalExpressions()
INTERNAL:
Verify that we have hierarchical query expressions
|
boolean |
hasOrderByExpressions()
INTERNAL:
The order bys are lazy initialized to conserv space.
|
boolean |
isAttributeBatchRead(String attributeName)
INTERNAL:
Return if the attribute is specified for batch reading.
|
boolean |
isReadAllQuery()
PUBLIC:
Return if this is a read all query.
|
protected void |
prepare()
INTERNAL:
Prepare the receiver for execution in a session.
|
protected void |
prepareCustomQuery(DatabaseQuery customQuery)
INTERNAL:
Set the properties needed to be cascaded into the custom query.
|
void |
prepareForExecution()
INTERNAL:
Prepare the receiver for execution in a session.
|
protected void |
prepareSelectAllRows()
INTERNAL:
Prepare the mechanism.
|
Object |
registerResultInUnitOfWork(Object result,
UnitOfWorkImpl unitOfWork,
AbstractRecord arguments,
boolean buildDirectlyFromRows)
INTERNAL:
All objects queried via a UnitOfWork get registered here.
|
void |
setContainerPolicy(ContainerPolicy containerPolicy)
PUBLIC:
Set the container policy.
|
void |
setOrderByExpressions(Vector orderByExpressions)
INTERNAL:
Set the order expressions for the query.
|
void |
useCollectionClass(Class concreteClass)
PUBLIC:
Configure the mapping to use an instance of the specified container class
to hold the target objects.
|
void |
useMapClass(Class concreteClass,
String methodName)
PUBLIC:
Configure the query to use an instance of the specified container class
to hold the result objects.
|
acquireLocks, acquireLocksWithoutWaiting, addAdditionalField, addAdditionalField, addJoinedAttribute, addJoinedAttribute, addNonFetchJoinedAttribute, addNonFetchJoinedAttribute, addSelectionFieldsForJoinedExpressions, buildObject, changeDescriptor, checkCacheOnly, checkDescriptor, checkEarlyReturn, checkPrepare, checkPrePrepare, conformIndividualResult, conformResultsInUnitOfWork, deepClone, dontAcquireLocks, dontCheckCache, dontRefreshIdentityMapResult, dontUseDistinct, execute, executeDatabaseQuery, executeInUnitOfWork, getAdditionalFields, getCacheUsage, getDistinctState, getExecutionTime, getExpressionBuilder, getFetchGroup, getFetchGroupName, getInMemoryQueryIndirectionPolicy, getJoinedAttributeManager, getLeafDescriptorFor, getLeafMappingFor, getLockingClause, getLockMode, getNonFetchJoinAttributeExpressions, getReferenceClass, getReferenceClassName, getSelectionFields, hasAsOfClause, hasFetchGroupAttributeExpressions, hasNonFetchJoinedAttributeExpressions, hasPartialAttributeExpressions, initializeDefaultBuilder, initializeFetchGroup, isClonePessimisticLocked, isDefaultLock, isDistinctComputed, isFetchGroupAttribute, isLockQuery, isLockQuery, isObjectLevelReadQuery, isPrePrepared, isRegisteringResults, prepareOutsideUnitOfWork, prepareQuery, prePrepare, recordCloneForPessimisticLocking, refreshIdentityMapResult, resetDistinct, setAdditionalFields, setCacheUsage, setDescriptor, setDistinctState, setEJBQLString, setExecutionTime, setExpressionBuilder, setFetchGroup, setFetchGroupName, setInMemoryQueryIndirectionPolicy, setIsPrePrepared, setLockingClause, setLockMode, setNonFetchJoinAttributeExpressions, setReferenceClass, setReferenceClassName, setSelectionCriteria, setShouldIncludeData, setShouldProcessResultsInUnitOfWork, setShouldRefreshIdentityMapResult, setShouldRegisterResultsInUnitOfWork, setShouldUseDefaultFetchGroup, setWasDefaultLockMode, shouldCheckCacheOnly, shouldCheckDescriptorForCacheUsage, shouldConformResultsInUnitOfWork, shouldDistinctBeUsed, shouldIncludeData, shouldProcessResultsInUnitOfWork, shouldReadAllMappings, shouldReadMapping, shouldRefreshIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseDefaultFetchGroup, toString, useDistinct, wasDefaultLockMode
convertClassNamesToClasses, dontRefreshRemoteIdentityMapResult, getDataResults, isAttributeJoined, isObjectBuildingQuery, refreshRemoteIdentityMapResult, registerIndividualResult, setShouldRefreshRemoteIdentityMapResult, shouldRefreshRemoteIdentityMapResult
clonedQueryExecutionComplete, getFirstResult, getMaxRows, getQueryId, isReadQuery, setFirstResult, setMaxRows, setQueryId
addArgument, addArgument, addArgument, addArgumentByTypeName, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, buildSelectionCriteria, cacheStatement, cascadeAllParts, cascadeByMapping, cascadeOnlyDependentParts, cascadePrivateParts, deploymentSetShouldMaintainCache, deploymentShouldMaintainCache, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getAccessor, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, getDescriptor, getEJBQLString, getFlushOnExecute, getName, getProperties, getProperty, getQueryMechanism, getSelectionCriteria, getSession, getSessionName, getShouldBindAllParameters, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, getTranslationRow, hasAccessor, hasProperties, hasQueryMechanism, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isCascadeOfAggregateDelete, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isExpressionQuery, isInsertObjectQuery, isModifyAllQuery, isModifyQuery, isObjectLevelModifyQuery, isPrepared, isReadObjectQuery, isReportQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isWriteObjectQuery, maintainCache, prepareCall, prepareForRemoteExecution, removeProperty, rowFromArguments, setAccessor, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setCall, setCascadePolicy, setDatasourceCall, setFlushOnExecute, setIsPrepared, setIsUserDefined, setName, setProperties, setProperty, setQueryMechanism, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldUseWrapperPolicy, setSQLStatement, setSQLString, setTranslationRow, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldUseWrapperPolicy
protected Vector orderByExpressions
protected ContainerPolicy containerPolicy
public ReadAllQuery()
public ReadAllQuery(Class classToRead)
public ReadAllQuery(Class classToRead, Expression selectionCriteria)
public ReadAllQuery(Class classToRead, ExpressionBuilder builder)
public ReadAllQuery(Class classToRead, Call call)
public ReadAllQuery(ExpressionBuilder builder)
public ReadAllQuery(Call call)
public void addAscendingOrdering(String queryKeyName)
public void addDescendingOrdering(String queryKeyName)
public void addOrdering(Expression orderingExpression)
protected Object checkEarlyReturnImpl(AbstractSession session, AbstractRecord translationRow)
checkEarlyReturnImpl
in class ObjectLevelReadQuery
protected DatabaseQuery checkForCustomQuery(AbstractSession session, AbstractRecord translationRow)
checkForCustomQuery
in class DatabaseQuery
public Object clone()
clone
in class ObjectLevelReadQuery
protected Object conformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows)
protected Object executeObjectLevelReadQuery() throws DatabaseException
executeObjectLevelReadQuery
in class ObjectLevelReadQuery
DatabaseException
- - an error has occurred on the databasepublic ContainerPolicy getContainerPolicy()
public Vector getOrderByExpressions()
public boolean hasOrderByExpressions()
public boolean hasHierarchicalExpressions()
public boolean hasBatchReadAttributes()
public boolean isAttributeBatchRead(String attributeName)
public boolean isReadAllQuery()
isReadAllQuery
in class DatabaseQuery
protected void prepare() throws QueryException
prepare
in class ObjectLevelReadQuery
QueryException
protected void prepareCustomQuery(DatabaseQuery customQuery)
prepareCustomQuery
in class DatabaseQuery
public void prepareForExecution() throws QueryException
prepareForExecution
in class DatabaseQuery
QueryException
protected void prepareSelectAllRows()
public Object registerResultInUnitOfWork(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows)
Involves registering the query result individually and in totality, and hence refreshing / conforming is done here.
registerResultInUnitOfWork
in class ObjectLevelReadQuery
result
- may 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.unitOfWork
- the unitOfWork the result is being registered in.arguments
- the original arguments/parameters passed to the query
execution. Used by conformingbuildDirectlyFromRows
- If in transaction must construct
a registered result from raw database rows.public void setContainerPolicy(ContainerPolicy containerPolicy)
public void setOrderByExpressions(Vector orderByExpressions)
public void useCollectionClass(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 useMapClass(Class concreteClass, 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.
Copyright © 2023. All rights reserved.