Top Description Fields Constructors Methods
org.eclipse.persistence.queries

public abstract Class ObjectLevelReadQuery

extends ObjectBuildingQuery
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.queries.ReadAllQuery, org.eclipse.persistence.queries.ReadObjectQuery
Imports
java.util.ArrayList, .Collection, .HashMap, .HashSet, .Iterator, .List, .Map, .Set, .Vector, java.util.concurrent.ConcurrentHashMap, .TimeUnit, org.eclipse.persistence.annotations.BatchFetchType, org.eclipse.persistence.descriptors.ClassDescriptor, .FetchGroupManager, .VersionLockingPolicy, org.eclipse.persistence.exceptions.DatabaseException, .OptimisticLockException, .QueryException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.history.AsOfClause, org.eclipse.persistence.internal.databaseaccess.DatabaseCall, org.eclipse.persistence.internal.descriptors.OptimisticLockingPolicy, org.eclipse.persistence.internal.expressions.FieldExpression, .ForUpdateClause, .ForUpdateOfClause, .ObjectExpression, .QueryKeyExpression, org.eclipse.persistence.internal.helper.DatabaseField, .DeferredLockManager, .InvalidObject, .NonSynchronizedVector, org.eclipse.persistence.internal.history.UniversalAsOfClause, org.eclipse.persistence.internal.queries.DatabaseQueryMechanism, .ExpressionQueryMechanism, .JoinedAttributeManager, .QueryByExampleMechanism, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .UnitOfWorkImpl, org.eclipse.persistence.logging.SessionLog, org.eclipse.persistence.mappings.CollectionMapping, .DatabaseMapping, .ForeignReferenceMapping

Purpose: Abstract class for all read queries using objects.

Description: Contains common behavior for all read queries using objects.

Author
Yvon Lavoie
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected List<Object>
additionalFields

Allow for additional fields to be selected, used for m-m batch reading.

protected Map<DatabaseMapping, ObjectLevelReadQuery>
aggregateQueries

Allow aggregate queries to be prepared and cached.

protected BatchFetchPolicy
batchFetchPolicy

Defines batch fetching configuration.

protected int
cacheUsage

Allow for the cache usage to be specified to enable in-memory querying.

public static final int
public static final int
public static final int
public static final int
protected Map<Class<?>, DatabaseCall>
concreteSubclassCalls

Allow concrete subclasses calls to be prepared and cached for inheritance queries.

protected Map<Class<?>, Map<DatabaseMapping, Object>>
concreteSubclassJoinedMappingIndexes

Allow concrete subclasses joined mapping indexes to be prepared and cached for inheritance queries.

protected Map<Class<?>, DatabaseQuery>
concreteSubclassQueries

Allow concrete subclasses queries to be prepared and cached for inheritance queries.

public static final int
protected ExpressionBuilder
defaultBuilder

Provide a default builder so that it's easier to be consistent

protected short
distinctState

Indicates if distinct should be used or not.

public static final int
public static final short
protected FetchGroup
fetchGroup

FetchGroup specified on this query.

protected String
fetchGroupName

Name of FetchGroup stored in the FetchGroupManager of the reference class' descriptor or any of its parent descriptors.

protected int
inMemoryQueryIndirectionPolicy

Used to determine behavior of indirection in in-memory querying and conforming.

protected boolean
isCachedExpressionQuery

Indicates whether the query is cached as an expression query in descriptor's query manager.

protected boolean
isPrePrepared

Allow a prePrepare stage to build the expression for EJBQL and QBE and resolve joining.

protected boolean
isReadOnly

PERF: Allow queries to be defined as read-only in unit of work execution.

protected Boolean
isReferenceClassLocked

PERF: Caches locking policy isReferenceClassLocked setting.

protected Boolean
isResultSetAccessOptimizedQuery

PERF: Allow queries to build while accessing the database result-set.

public static boolean
isResultSetAccessOptimizedQueryDefault

If neither query specifies isResultSetOptimizedQuery nor session specifies shouldOptimizeResultSetAccess then this value is used to indicate whether optimization should be attempted

protected boolean
isResultSetOptimizedQuery

PERF: Allow queries to build directly from the database result-set.

protected JoinedAttributeManager
joinedAttributeManager

Stores the helper object for dealing with joined attributes

protected LoadGroup
loadGroup

Specifies indirection that should be instantiated before returning result

protected String
lockModeType

Used when specifying a lock mode for the query

public static final String
NONE

Names of the possible lock mode types, JPA 2.0 only

protected List<Expression>
nonFetchJoinAttributeExpressions

Stores the non fetchjoin attributes, these are joins that will be represented in the where clause but not in the select.

public static final String
public static final String
protected List<Expression>
orderByExpressions

Used for ordering support.

protected List<Expression>
partialAttributeExpressions

Stores the partial attributes that have been added to this query

public static final String
public static final String
public static final String
public static final String
public static final String
READ

Names of the possible lock mode types, JPA 1.0 and 2.0

protected boolean
shouldExtendPessimisticLockScope

Indicates whether pessimistic lock should also be applied to relation tables (ManyToMany and OneToOne mappings), reference tables (DirectCollection and AggregateCollection mapping).

protected boolean
shouldIncludeData

Allow for a complex result to be return including the rows and objects, used for m-m batch reading.

protected Boolean
shouldOuterJoinSubclasses

Define if an outer join should be used to read subclasses.

protected boolean
shouldUseDefaultFetchGroup

Flag to turn on/off the use of the default fetch group.

protected boolean
shouldUseSerializedObjectPolicy

Indicates whether the query should use SerializedObjectPolicy if descriptor has it.

public static boolean
shouldUseSerializedObjectPolicyDefault

default value for shouldUseSerializedObjectPolicy

public static final short
protected List<Expression>
unionExpressions

Allow a query's results to be unioned (UNION, INTERSECT, EXCEPT) with another query results.

public static final short
public static final int
protected transient Boolean
usesResultSetAccessOptimization

PERF: Indicates whether the query is actually using ResultSet optimization.

protected Integer
waitTimeout

waitTimeout has three possible setting: null, 0 and 1..N null: use the session.getPessimisticLockTimeoutDefault() if available.

protected TimeUnit
public static final String
Inherited from org.eclipse.persistence.queries.ObjectBuildingQuery:
DEFAULT_LOCK_MODEexecutionTimeisCacheCheckCompleteLOCKLOCK_NOWAITLOCK_RESULT_PROPERTYlockingClauseNO_LOCKprefetchedCacheKeysprintInnerJoinInWhereClausereferenceClassreferenceClassNamerequiresDeferredLocksshouldBuildNullForNullPkshouldRefreshIdentityMapResultshouldRefreshRemoteIdentityMapResultshouldRegisterResultsInUnitOfWorkshouldUseExclusiveConnectionwasDefaultLockMode

Constructor Summary

AccessConstructor and Description
protected
ObjectLevelReadQuery()

INTERNAL: Initialize the state of the query

Method Summary

Modifier and TypeMethod and Description
public void
acquireLocks()

PUBLIC: Set the query to lock, this will also turn refreshCache on.

public void
acquireLocksWithoutWaiting()

PUBLIC: Set the query to lock without waiting (blocking), this will also turn refreshCache on.

public void
addAdditionalField(DatabaseField field)

INTERNAL: Additional fields can be added to a query.

public void
addAdditionalField(Expression fieldExpression)

INTERNAL: Additional fields can be added to a query.

public void
addBatchReadAttribute(String attributeName)

PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query.

public void
addBatchReadAttribute(Expression attributeExpression)

PUBLIC: Specify the foreign-reference mapped attribute to be optimized in this query.

public void
addDescendingOrdering(String queryKeyName)

PUBLIC: Order the query results by the object's attribute or query key name.

public void
addJoinedAttribute(String attributeName)

PUBLIC: Specify the relationship attribute to be join fetched in this query.

public void
addJoinedAttribute(Expression attributeExpression)

PUBLIC: Specify the attribute to be join fetched in this query.

public void
addJoinSelectionFields(Vector<E> fields, boolean isCustomSQL)

INTERNAL: The method adds to the passed input vector the fields or expressions corresponding to the joins.

public void
addNonFetchJoin(Expression target)

PUBLIC: Specify the object expression to be joined in this query.

public void
addNonFetchJoinedAttribute(String attributeName)

PUBLIC: Specify the relationship attribute to be join in this query.

public void
addNonFetchJoinedAttribute(Expression attributeExpression)

PUBLIC: Specify the relationship attribute to be join in this query.

public void
addOrdering(Expression orderingExpression)

PUBLIC: Add the ordering expression.

public void
addPartialAttribute(String attributeName)

Deprecated since EclipseLink 2.1, partial attributes replaced by fetch groups.
PUBLIC: Specify that only a subset of the class' attributes be selected in this query.
public void
addPartialAttribute(Expression attributeExpression)

Deprecated since EclipseLink 2.1, partial attributes replaced by fetch groups.
PUBLIC: Specify that only a subset of the class' attributes be selected in this query.
protected void
addSelectionFieldsForJoinedExpression(List<E> fields, boolean isCustomSQL, Expression expression)

INTERNAL: The method adds to the passed input vector the fields or expressions corresponding to the passed join expression.

public void
addUnionExpression(Expression union)

PUBLIC: Add the union expression to the query.

public Object
buildObject(AbstractRecord row)

Overrides org.eclipse.persistence.queries.ReadQuery.buildObject.

INTERNAL: Used to build the object, and register it if in the context of a unit of work.
public void
changeDescriptor(AbstractSession theSession)

INTERNAL: The reference class has been changed, need to reset the descriptor.

public void
checkCacheOnly()

PUBLIC: The cache will checked completely, if the object is not found null will be returned or an error if the query is too complex.

protected abstract Boolean

Returns:

Current custom query flag. Value shall never be null.
checkCustomQueryFlag
(final AbstractSession
Current session.
session
,
final AbstractRecord
Database record.
translationRow
)

INTERNAL: Check and return custom query flag.

public void
checkDescriptor(AbstractSession
Current session.
session
)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkDescriptor.

INTERNAL: Ensure that the descriptor has been set.
public Object
checkEarlyReturn(AbstractSession session, AbstractRecord translationRow)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkEarlyReturn.

INTERNAL: Check to see if this query already knows the return value without performing any further work.
protected abstract Object
checkEarlyReturnLocal(AbstractSession session, AbstractRecord translationRow)

INTERNAL: Contains the body of the check early return call, implemented by subclasses.

protected DatabaseQuery

Returns:

Custom database query or null when custom database query is not set.
checkForCustomQuery
(final AbstractSession
Current session.
session
,
final AbstractRecord
Database record.
translationRow
)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkForCustomQuery.

INTERNAL: Check to see if a custom query should be used for this query.
public void
checkPrepare(AbstractSession session, AbstractRecord translationRow, boolean force)

Overrides org.eclipse.persistence.queries.DatabaseQuery.checkPrepare.

INTERNAL: Check to see if this query needs to be prepare and prepare it.
public void
checkPrePrepare(AbstractSession session)

INTERNAL: ObjectLevelReadQueries now have an explicit pre-prepare stage, which is for checking for pessimistic locking, and computing any joined attributes declared on the descriptor.

public void
clearIsResultSetOptimizedQuery()

ADVANCED: Clear the flag set by setIsResultSetOptimizedQuery method, allow to use default set on the session instead.

public void
public Object

Returns:

A clone of this instance.
clone
()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.clone.

INTERNAL: Creates and returns a copy of this query.
public void
computeBatchReadAttributes()

INTERNAL: Compute the cache batched attributes.

public void
computeBatchReadMappingQueries()

INTERNAL: Used to optimize joining by pre-computing the nested join queries for the mappings.

protected void
computeNestedQueriesForBatchReadExpressions(List<Expression> batchReadExpressions)

INTERNAL: This method is used when computing the nested queries for batch read mappings.

protected Object

Returns:

a clone, or null if result does not conform.
conformIndividualResult
(Object
the clone to return
clone
,
UnitOfWorkImpl
current UnitOfWork
unitOfWork
,
AbstractRecord
the parameters this query was executed with
arguments
,
Expression
the expression to conform to. If was a selection object or key, null (which all conform to) is used
selectionCriteriaClone
,
Map<K, V>
a hashtable of objects already found by scanning the UnitOfWork cache for conforming instances. Prevents duplicates.
alreadyReturned
)

INTERNAL: Conforms and registers an individual result.

public void
conformResultsInUnitOfWork()

PUBLIC: The cache will checked completely, if the object is not found the database will be queried, and the database result will be verified with what is in the cache and/or unit of work including new objects.

public void
copyFromQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.copyFromQuery.

INTERNAL: Copy all setting from the query.
public Object
deepClone()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.deepClone.

INTERNAL: Clone the query, including its selection criteria.
public void
dontAcquireLocks()

PUBLIC: Set the query not to lock.

public void
dontCheckCache()

PUBLIC: This can be used to explicitly disable the cache hit.

public void
dontRefreshIdentityMapResult()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.dontRefreshIdentityMapResult.

PUBLIC: When unset means perform read normally and dont do refresh.
public void
dontRefreshRemoteIdentityMapResult()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.dontRefreshRemoteIdentityMapResult.

PUBLIC: When unset means perform read normally and dont do refresh.
public void
dontUseDistinct()

ADVANCED: If a distinct has been set the DISTINCT clause will be printed.

public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides java.lang.Object.equals.

INTERNAL: Return if the query is equal to the other.
public void
except(ReportQuery query)

PUBLIC: Except the query results with the other query.

public Object

Returns:

An object, the result of executing the query.
execute
(AbstractSession
- the session in which the receiver will be executed.
session
,
AbstractRecord translationRow)

Overrides org.eclipse.persistence.queries.DatabaseQuery.execute.

INTERNAL: Execute the query.
public Object
executeDatabaseQuery()

Implements abstract org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

INTERNAL: Executes the prepared query on the datastore.
public Object
executeInUnitOfWork(UnitOfWorkImpl
- the session in which the receiver will be executed.
unitOfWork
,
AbstractRecord
- the arguments
translationRow
)

Overrides org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork.

INTERNAL: Execute the query in the unit of work.
protected abstract Object
executeObjectLevelReadQuery()

Executes the prepared query on the datastore.

protected abstract Object
executeObjectLevelReadQueryFromResultSet()

Executes the prepared query on the datastore.

public void
extendPessimisticLockScope()

INTERNAL: Extends pessimistic lock scope.

public List<Object>
getAdditionalFields()

INTERNAL: Additional fields can be added to a query.

public Map<DatabaseMapping, ObjectLevelReadQuery>
getAggregateQueries()

INTERNAL: Return the cache of aggregate queries.

public ObjectLevelReadQuery
getAggregateQuery(DatabaseMapping mapping)

INTERNAL: Return the aggregate query clone for the mapping.

public AsOfClause

Returns:

An immutable object representation of the past time. null if no clause set, AsOfClause.NO_CLAUSE if clause explicitly set to null.
getAsOfClause
()

ADVANCED: Answers the past time this query is as of.

public BatchFetchPolicy
getBatchFetchPolicy()

Return the batch fetch policy for configuring batch fetching.

public Map<Object, Object>
getBatchObjects()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getBatchObjects.

INTERNAL: Return temporary map of batched objects.
public List<Expression>
getBatchReadAttributeExpressions()

INTERNAL: Return all attributes specified for batch reading.

public int
getCacheUsage()

PUBLIC: Return the cache usage.

public Map<Class<?>, DatabaseCall>
getConcreteSubclassCalls()

INTERNAL: Return the cache of concrete subclass calls.

public Map<Class<?>, Map<DatabaseMapping, Object>>
getConcreteSubclassJoinedMappingIndexes()

INTERNAL: Return the cache of concrete subclass joined mapping indexes.

public Map<Class<?>, DatabaseQuery>
getConcreteSubclassQueries()

INTERNAL: Return the cache of concrete subclass queries.

public short
getDistinctState()

ADVANCED: If a distinct has been set the DISTINCT clause will be printed.

public Object
getExampleObject()

PUBLIC: This method returns the current example object.

public FetchGroup
getExecutionFetchGroup()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getExecutionFetchGroup.

INTERNAL: Returns FetchGroup that will be applied to the query.
public FetchGroup
getExecutionFetchGroup(ClassDescriptor descriptor)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getExecutionFetchGroup.

INTERNAL: Returns FetchGroup that will be applied to the query.
public ExpressionBuilder
getExpressionBuilder()

REQUIRED: Get the expression builder which should be used for this query.

public FetchGroup
getFetchGroup()

Return the fetch group set in the query.

public String
getFetchGroupName()

Return the fetch group name set in the query.

public Set<DatabaseField>
getFetchGroupNonNestedFieldsSet()

INTERNAL: Return the set of fields required in the select clause, for fetch group reading.

public Set<DatabaseField>
getFetchGroupNonNestedFieldsSet(DatabaseMapping nestedMapping)

INTERNAL: Return the set of fields required in the select clause, for fetch group reading.

public List<DatabaseField>
getFetchGroupSelectionFields()

INTERNAL: Return the fields required in the select clause, for fetch group reading.

protected List<DatabaseField>
getFetchGroupSelectionFields(DatabaseMapping nestedMapping)

INTERNAL: Return the fields required in the select clause, for fetch group reading.

public InMemoryQueryIndirectionPolicy
getInMemoryQueryIndirectionPolicy()

PUBLIC: Returns the InMemoryQueryIndirectionPolicy for this query

public int
getInMemoryQueryIndirectionPolicyState()

PUBLIC: Returns the InMemoryQueryIndirectionPolicy for this query

public List<E>
getJoinedAttributeExpressions()

INTERNAL: Convenience method for project mapping.

public JoinedAttributeManager
getJoinedAttributeManager()

INTERNAL: Return join manager responsible for managing all aspects of joining for the query.

public LoadGroup
getLoadGroup()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getLoadGroup.

Return the load group set in the query.
public ForUpdateClause
getLockingClause()

INTERNAL: It is not exactly as simple as a query being either locking or not.

public String
getLockModeType()

INTERNAL: returns the jakarta.persistence.LockModeType string value set on this query.

public List<Expression>
getNonFetchJoinAttributeExpressions()

INTERNAL: Return the attributes that must be joined, but not fetched, that is, do not trigger the value holder.

public List<Expression>
getOrderByExpressions()

INTERNAL: Return the order expressions for the query.

public List<Expression>
getPartialAttributeExpressions()

INTERNAL: Return the partial attributes to select.

public Vector<E>
getPartialAttributeSelectionFields(boolean isCustomSQL)

INTERNAL: Return the fields required in the select clause, for patial attribute reading.

public QueryByExamplePolicy
getQueryByExamplePolicy()

PUBLIC: When using Query By Example, an instance of QueryByExamplePolicy is used to customize the query.

protected abstract ObjectLevelReadQuery

Returns:

Custom read query from query manager.
getReadQuery
()

INTERNAL: Get custom read query from query manager.

public Class<?>
getReferenceClass()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getReferenceClass.

PUBLIC: Return the reference class of the query.
public String
getReferenceClassName()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getReferenceClassName.

INTERNAL: Return the reference class of the query.
public Vector<E>
getSelectionFields()

INTERNAL: Return the fields selected by the query.

public List<Expression>
getUnionExpressions()

Return any union expressions.

public Integer
getWaitTimeout()

PUBLIC: Return the WAIT timeout value of pessimistic locking query.

public TimeUnit
public boolean
hasAdditionalFields()

INTERNAL: Return if additional field.

public boolean
hasAsOfClause()

PUBLIC: Answers if the domain objects are to be read as of a past time.

public boolean
hasBatchReadAttributes()

INTERNAL: Return true is this query has batching

public boolean
hasDefaultBuilder()

INTERNAL: Checks to see if a builder has been set on the query.

public boolean
hasExecutionFetchGroup()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.hasExecutionFetchGroup.

INTERNAL: Indicates whether a FetchGroup will be applied to the query.
public boolean
hasFetchGroup()

Return if a fetch group is set in the query.

public int
hashCode()

Overrides java.lang.Object.hashCode.

INTERNAL: Compute a consistent hash-code for the expression.
public boolean
hasJoining()

INTERNAL: Return if any attributes are joined.

public boolean
hasNonFetchJoinedAttributeExpressions()

INTERNAL: Return the attributes that must be joined.

public boolean
hasOrderByExpressions()

INTERNAL: The order bys are lazy initialized to conserve space.

public boolean
public boolean
hasUnionExpressions()

INTERNAL: The unions are lazy initialized to conserve space.

protected void
initializeDefaultBuilder()

Initialize the expression builder which should be used for this query.

public void
intersect(ReportQuery query)

PUBLIC: Intersect the query results with the other query.

public boolean
isAttributeBatchRead(ClassDescriptor mappingDescriptor, String attributeName)

INTERNAL: Return if the attribute is specified for batch reading.

public boolean
isCachedExpressionQuery()

INTERNAL: Indicates whether the query is cached as an expression query in descriptor's query manager.

public boolean
isClonePessimisticLocked(Object clone, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.isClonePessimisticLocked.

INTERNAL: Helper method that checks if clone has been locked with uow.
public boolean
isDefaultLock()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.isDefaultLock.

INTERNAL: Helper method to determine the default mode.
public boolean
isDefaultPropertiesQuery()

Overrides org.eclipse.persistence.queries.ReadQuery.isDefaultPropertiesQuery.

INTERNAL: Return true if the query uses default properties.
public boolean
isDistinctComputed()

INTERNAL: return true if this query has computed its distinct value already

public boolean
isLockQuery()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.isLockQuery.

PUBLIC: Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT.
public boolean
isLockQuery(Session session)

ADVANCED: Answers if this query will issue any pessimistic locks.

public boolean
isObjectLevelReadQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isObjectLevelReadQuery.

PUBLIC: Return if this is an object level read query.
public boolean
isPartialAttribute(String attributeName)

INTERNAL: Return if partial attribute.

protected boolean
isPrePrepared()

PUBLIC: Queries prepare common stated in themselves.

public boolean
isPrimaryKeyQuery()

INTERNAL: Return if the query is known to be by primary key.

public boolean
isReadOnly()

PUBLIC: Return if the query is read-only.

protected boolean
isReferenceClassLocked()

INTERNAL: Cache the locking policy isReferenceClassLocked check.

public Boolean
isResultSetAccessOptimizedQuery()

ADVANCED: Return if the query result set access should be optimized.

public boolean
isResultSetOptimizedQuery()

ADVANCED: Return if the query should be optimized to build directly from the result set.

protected void
prepare()

Overrides org.eclipse.persistence.queries.ReadQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.
public void
prepareFetchGroup()

INTERNAL: Add mandatory attributes to fetch group, create entityFetchGroup.

protected void
prepareForRemoteExecution()

Overrides org.eclipse.persistence.queries.DatabaseQuery.prepareForRemoteExecution.

INTERNAL: Prepare the receiver for execution in a session.
protected boolean
prepareFromCachedQuery()

INTERNAL: Check if the query is cached and prepare from it.

public void
prepareFromQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.prepareFromQuery.

INTERNAL: Prepare the query from the prepared query.
public DatabaseQuery
prepareOutsideUnitOfWork(AbstractSession session)

INTERNAL: There is a very special case where a query may be a bean-level pessimistic locking query.

protected void
prepareQuery()

INTERNAL: Prepare the receiver for execution in a session.

protected void
prepareResultSetAccessOptimization()

INTERNAL: Sets usesResultSetAccessOptimization based on isResultSetAccessOptimizedQuery, session default and query settings that could not be altered without re-preparing the query.

protected void
prePrepare()

INTERNAL: Prepare the receiver for execution in a session.

public void
recordCloneForPessimisticLocking(Object clone, UnitOfWorkImpl uow)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.recordCloneForPessimisticLocking.

INTERNAL: Helper method that records clone with uow if query is pessimistic locking.
public void
refreshIdentityMapResult()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.refreshIdentityMapResult.

PUBLIC: Refresh the attributes of the object(s) resulting from the query.
public void
refreshRemoteIdentityMapResult()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.refreshRemoteIdentityMapResult.

PUBLIC: Refresh the attributes of the object(s) resulting from the query.
public abstract Object

Returns:

the final (conformed, refreshed, wrapped) UnitOfWork query result
registerResultInUnitOfWork
(Object
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.
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
)

INTERNAL: All objects queried via a UnitOfWork get registered here.

public void
resetDistinct()

ADVANCED: If a distinct has been set the DISTINCT clause will be printed.

public void
setAdditionalFields(List<Object> additionalFields)

INTERNAL: Additional fields can be added to a query.

public void
setAggregateQuery(DatabaseMapping mapping, ObjectLevelReadQuery query)

INTERNAL: Set the aggregate query clone for the mapping.

public void
setAsOfClause(AsOfClause pastTime)

ADVANCED: Sets the query to execute as of the past time.

public void
setBatchFetchPolicy(BatchFetchPolicy batchFetchPolicy)

Set the batch fetch policy for configuring batch fetching.

public void
setBatchFetchSize(int size)

PUBLIC: Set the batch fetch size for the query.

public void
setBatchFetchType(BatchFetchType type)

PUBLIC: Set the batch fetch type for the query.

public void
setBatchObjects(Map<Object, Object> batchObjects)

Overrides org.eclipse.persistence.queries.DatabaseQuery.setBatchObjects.

INTERNAL: Set temporary map of batched objects.
public void
setBatchReadAttributeExpressions(List<Expression> attributeExpressions)

INTERNAL: Set all attributes specified for batch reading.

public void
setCacheUsage(int cacheUsage)

PUBLIC: Set the cache usage.

public void
setDescriptor(ClassDescriptor descriptor)

Overrides org.eclipse.persistence.queries.DatabaseQuery.setDescriptor.

INTERNAL: Set the descriptor for the query.
public void
setDistinctState(short distinctState)

ADVANCED: If a distinct has been set the DISTINCT clause will be printed.

public void
setEJBQLString(String ejbqlString)

Overrides org.eclipse.persistence.queries.DatabaseQuery.setEJBQLString.

PUBLIC: Set the EJBQL string of the query.
public void
setExampleObject(Object newExampleObject)

PUBLIC: Set the example object of the query to be the newExampleObject.

public void
setExpressionBuilder(ExpressionBuilder builder)

INTERNAL Sets the default expression builder for this query.

public void
setFetchGroup(FetchGroup newFetchGroup)

Set a dynamic (use case) fetch group to the query.

public void
setFetchGroupName(String groupName)

Set a descriptor-level pre-defined named fetch group to the query.

public void
setInMemoryQueryIndirectionPolicy(InMemoryQueryIndirectionPolicy inMemoryQueryIndirectionPolicy)

PUBLIC: Set the InMemoryQueryIndirectionPolicy for this query.

public void
setInMemoryQueryIndirectionPolicyState(int inMemoryQueryIndirectionPolicy)

PUBLIC: Set the InMemoryQueryIndirectionPolicy for this query.

public void
setIsPrepared(boolean isPrepared)

Overrides org.eclipse.persistence.queries.DatabaseQuery.setIsPrepared.

INTERNAL: Clear cached flags when un-preparing.
protected void
setIsPreparedKeepingSubclassData(boolean isPrepared)

INTERNAL: Clear cached flags when un-preparing.

public void
setIsPrePrepared(boolean isPrePrepared)

INTERNAL: If changes are made to the query that affect the derived SQL or Call parameters the query needs to be prepared again.

public void
setIsReadOnly(boolean isReadOnly)

PUBLIC: Set the query to be read-only.

public void
setIsResultSetAccessOptimizedQuery(boolean isResultSetAccessOptimizedQuery)

ADVANCED: Set if the query should be optimized to build directly from the result set.

public void
setIsResultSetOptimizedQuery(boolean isResultSetOptimizedQuery)

ADVANCED: Set if the query should be optimized to build directly from the result set.

public void
setJoinedAttributeExpressions(List<E> expressions)

INTERNAL: Convenience method for project mapping.

public void
setJoinedAttributeManager(JoinedAttributeManager joinedAttributeManager)

INTERNAL: Set join manager responsible for managing all aspects of joining for the query.

public void
setLoadGroup(LoadGroup loadGroup)

Set a load group to the query.

public void
setLockingClause(ForUpdateClause clause)

INTERNAL: The locking clause contains a list of expressions representing which objects are to be locked by the query.

public void
setLockMode(short lockMode)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.setLockMode.

PUBLIC: Sets whether this is a pessimistically locking query.
public boolean

Returns:

returns a failure flag indicating that we were UNABLE to set the lock mode because of validation. Callers to this method should check the return value and throw the necessary exception.
setLockModeType
(String lockModeType, AbstractSession session)

INTERNAL: Sets a jakarta.persistence.LockModeType to used with this queries execution.

public void
setNonFetchJoinAttributeExpressions(List<Expression> nonFetchJoinExpressions)

INTERNAL: Return the attributes that must be joined, but not fetched, that is, do not trigger the value holder.

public void
setOrderByExpressions(List<Expression> orderByExpressions)

INTERNAL: Set the order expressions for the query.

public void
setPartialAttributeExpressions(List<Expression> partialAttributeExpressions)

INTERNAL: Set the partial attributes to select.

public void
setQueryByExamplePolicy(QueryByExamplePolicy queryByExamplePolicy)

PUBLIC: The QueryByExamplePolicy, is a useful to customize the query when Query By Example is used.

public void
setReferenceClass(Class<?> aClass)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.setReferenceClass.

REQUIRED: Set the reference class for the query.
public void
setReferenceClassName(String aClass)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.setReferenceClassName.

INTERNAL: Set the reference class for the query.
public void
setSelectionCriteria(Expression expression)

Overrides org.eclipse.persistence.queries.DatabaseQuery.setSelectionCriteria.

PUBLIC: Set the Expression/where clause of the query.
public void
setShouldExtendPessimisticLockScope(boolean isExtended)

INTERNAL: Indicates whether pessimistic lock should also be applied to relation tables (ManyToMany and OneToOne mappings), reference tables (DirectCollection and AggregateCollection mapping).

public void
setShouldFilterDuplicates(boolean shouldFilterDuplicates)

PUBLIC: Set if duplicate rows should be filter when using 1-m joining.

public void
setShouldIncludeData(boolean shouldIncludeData)

INTERNAL: Set if the rows for the result of the query should also be returned using a complex query result.

public void
setShouldOuterJoinSubclasses(boolean shouldOuterJoinSubclasses)

PUBLIC: Set if an outer join should be used to read subclasses.

public void
setShouldUseDefaultFetchGroup(boolean shouldUseDefaultFetchGroup)

Set false if the user does not want to use the default fetch group defined in the descriptor level.

public void
setShouldUseSerializedObjectPolicy(boolean shouldUseSerializedObjectPolicy)

INTERNAL: Set a flag that indicates whether the query should use SerializedObjectPolicy if descriptor has it.

public void
setUnionExpressions(List<Expression> unionExpressions)

INTERNAL: Set any union expressions.

public void
setWaitTimeout(Integer waitTimeout)

PUBLIC: Sets that this a pessimistic wait locking query.

public void
setWaitTimeoutUnit(TimeUnit waitTimeoutUnit)

public boolean
shouldCheckCache()

PUBLIC: Return if the cache should be checked.

public boolean
shouldCheckCacheOnly()

PUBLIC: Return if cache should be checked.

public boolean
shouldCheckDescriptorForCacheUsage()

PUBLIC: Return whether the descriptor's disableCacheHits setting should be checked prior to querying the cache.

public boolean
shouldConformResultsInUnitOfWork()

PUBLIC: Should the results will be checked against the changes within the unit of work and object no longer matching or deleted will be remove, matching new objects will also be added..

public boolean
shouldDistinctBeUsed()

INTERNAL: return true if this query should use a distinct

public boolean
shouldExtendPessimisticLockScope()

INTERNAL: Indicates whether pessimistic lock should also be applied to relation tables (ManyToMany and OneToOne mappings), reference tables (DirectCollection and AggregateCollection mapping).

public boolean
shouldFilterDuplicates()

PUBLIC: Return if duplicate rows should be filter when using 1-m joining.

public boolean
shouldIncludeData()

INTERNAL: Return if the rows for the result of the query should also be returned using a complex query result.

public boolean
shouldOuterJoinSubclasses()

PUBLIC: Return if an outer join should be used to read subclasses.

public boolean
shouldReadAllMappings()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.shouldReadAllMappings.

INTERNAL: Return if this is a full object query, not partial nor fetch group.
public boolean
shouldReadMapping(DatabaseMapping mapping, FetchGroup fetchGroup)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.shouldReadMapping.

INTERNAL: Check if the mapping is part of the partial attributes.
public boolean
shouldUseDefaultFetchGroup()

Return false if the query does not use the default fetch group defined in the descriptor level.

public boolean
shouldUseSerializedObjectPolicy()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.shouldUseSerializedObjectPolicy.

INTERNAL: Indicates whether the query should use SerializedObjectPolicy if descriptor has it.
public boolean
supportsResultSetAccessOptimizationOnExecute()

INTERNAL: Indicates whether the query can use ResultSet optimization.

public boolean
supportsResultSetAccessOptimizationOnPrepare()

INTERNAL: Indicates whether the query can use ResultSet optimization.

public String
toString()

Overrides org.eclipse.persistence.queries.DatabaseQuery.toString.

Returns a string representation of the object.
public void
union(ReportQuery query)

PUBLIC: Union the query results with the other query.

public void
useDistinct()

ADVANCED: If a distinct has been set the DISTINCT clause will be printed.

public boolean
Inherited from org.eclipse.persistence.queries.ObjectBuildingQuery:
clonedQueryExecutionCompleteconvertClassNamesToClassesgetDataResultsgetExecutionTimegetLockModegetPrefetchedCacheKeysgetQueryPrimaryKeyisAttributeJoinedisCacheCheckCompleteisObjectBuildingQueryisRegisteringResultspostRegisterIndividualResultprepareCustomQueryprintInnerJoinInWhereClauseregisterIndividualResultrequiresDeferredLockssetExecutionTimesetPrefetchedCacheKeyssetPrintInnerJoinInWhereClausesetRequiresDeferredLockssetShouldBuildNullForNullPksetShouldRefreshIdentityMapResultsetShouldRefreshRemoteIdentityMapResultsetShouldRegisterResultsInUnitOfWorksetShouldUseExclusiveConnectionsetWasDefaultLockModeshouldBuildNullForNullPkshouldRefreshIdentityMapResultshouldRefreshRemoteIdentityMapResultshouldRegisterResultsInUnitOfWorkshouldUseExclusiveConnectionwasDefaultLockMode