Class ObjectBuildingQuery
- java.lang.Object
-
- org.eclipse.persistence.queries.DatabaseQuery
-
- org.eclipse.persistence.queries.ReadQuery
-
- org.eclipse.persistence.queries.ObjectBuildingQuery
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
ObjectLevelReadQuery,ResultSetMappingQuery
public abstract class ObjectBuildingQuery extends ReadQuery
Purpose: Abstract class for all read queries that build objects and potentially manipulate the TopLink cache.
Description: Contains common behavior for all read queries building objects.
- See Also:
- Serialized Form
- Author:
- Gordon Yorke
- Since:
- TopLink Essentials
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.persistence.queries.DatabaseQuery
DatabaseQuery.ParameterType
-
-
Field Summary
Fields Modifier and Type Field Description static shortDEFAULT_LOCK_MODEprotected longexecutionTimeUsed to set the read time on objects that use this query.protected booleanisCacheCheckCompletewas a check early return completedstatic shortLOCKstatic shortLOCK_NOWAITstatic java.lang.StringLOCK_RESULT_PROPERTYINTERNAL: This is the key for accessing unregistered and locked result in the query's properties.protected org.eclipse.persistence.internal.expressions.ForUpdateClauselockingClauseUsed for pessimistic locking.static shortNO_LOCKprotected java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey>prefetchedCacheKeysprotected java.lang.BooleanprintInnerJoinInWhereClauseIndicates whether the query printer/normalizer changes the way that inner joins are printed in generated SQL for the database.protected java.lang.ClassreferenceClassThe class of the target objects to be read from the database.protected java.lang.StringreferenceClassNameprotected java.lang.BooleanrequiresDeferredLocksWhen reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its ownerprotected booleanshouldBuildNullForNullPkINTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).protected booleanshouldRefreshIdentityMapResultAllows for the resulting objects to be refresh with the data from the database.protected booleanshouldRefreshRemoteIdentityMapResultprotected booleanshouldRegisterResultsInUnitOfWorkINTERNAL: for bug 2612601 allow ability not to register results in UOW.protected booleanshouldUseExclusiveConnectionAdded for Exclusive Connection (VPD) support see accessor for informationprotected booleanwasDefaultLockModePERF: Store if the query originally used the default lock mode.-
Fields inherited from class org.eclipse.persistence.queries.ReadQuery
allowQueryResultsCacheValidation, fetchSize, firstResult, maxResults, maxRows, queryId, queryResultCachingPolicy, temporaryCachedQueryResults
-
Fields inherited from class org.eclipse.persistence.queries.DatabaseQuery
accessors, allowNativeSQLQuery, argumentFields, argumentParameterTypes, arguments, argumentTypeNames, argumentTypes, argumentValues, BATCH_FETCH_PROPERTY, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, cascadePolicy, CascadePrivateParts, descriptor, descriptors, doNotRedirect, executionSession, flushOnExecute, hintString, isCustomQueryUsed, isExecutionClone, isNativeConnectionRequired, isPrepared, isUserDefined, isUserDefinedSQLCall, monitorName, name, NoCascading, nullableArguments, parameterDelimiter, partitioningPolicy, properties, queryMechanism, queryTimeout, queryTimeoutUnit, redirector, session, sessionName, shouldBindAllParameters, shouldCacheStatement, shouldCloneCall, shouldMaintainCache, shouldPrepare, shouldRetrieveBypassCache, shouldReturnGeneratedKeys, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, sourceMapping, translationRow
-
-
Constructor Summary
Constructors Constructor Description ObjectBuildingQuery()INTERNAL: Initialize the state of the query
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()INTERNAL: Clone the queryprotected voidclonedQueryExecutionComplete(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query.voidconvertClassNamesToClasses(java.lang.ClassLoader classLoader)INTERNAL: Convert all the class-name-based settings in this query to actual class-based settings.voidcopyFromQuery(DatabaseQuery query)INTERNAL: Copy all setting from the query.java.lang.ObjectdeepClone()INTERNAL: Clone the query, including its selection criteria.voiddontRefreshIdentityMapResult()PUBLIC: When unset means perform read normally and dont do refresh.voiddontRefreshRemoteIdentityMapResult()PUBLIC: When unset means perform read normally and dont do refresh.java.util.ListgetDataResults()INTERNAL: Return all of the rows fetched by the query, used for 1-m joining.FetchGroupgetExecutionFetchGroup()INTERNAL: Returns FetchGroup that will be applied to the query.FetchGroupgetExecutionFetchGroup(ClassDescriptor descriptor)INTERNAL: Returns FetchGroup that will be applied to the query.longgetExecutionTime()INTERNAL: Return the time this query actually went to the databaseLoadGroupgetLoadGroup()Return the load group set in the query.shortgetLockMode()PUBLIC: Return the current locking mode.java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey>getPrefetchedCacheKeys()protected java.lang.ObjectgetQueryPrimaryKey()INTERNAL: Return the primary key stored in this query if there is one This is overridden by subclasses that actually hold a primary keyjava.lang.ClassgetReferenceClass()PUBLIC: Return the reference class of the query.java.lang.StringgetReferenceClassName()INTERNAL: Return the reference class of the query.booleanhasExecutionFetchGroup()INTERNAL: Indicates whether a FetchGroup will be applied to the query.booleanhasPartialAttributeExpressions()INTERNAL: Return if partial attributes.booleanisAttributeJoined(ClassDescriptor mappingDescriptor, java.lang.String attributeName)INTERNAL: Return if the attribute is specified for joining.booleanisCacheCheckComplete()INTERNAL: Returns true if an early return cache check was completedbooleanisClonePessimisticLocked(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Helper method that checks if clone has been locked with uow.booleanisDefaultLock()INTERNAL: Helper method to determine the default mode.booleanisLockQuery()PUBLIC: Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT.booleanisObjectBuildingQuery()PUBLIC: Return if this is an object building query.booleanisRegisteringResults()INTERNAL: Answers if we are executing through a UnitOfWork and registering results.voidpostRegisterIndividualResult(java.lang.Object clone, java.lang.Object original, java.lang.Object primaryKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ClassDescriptor concreteDescriptor)Post process the object once it is registered in the unit of work.protected voidprepareCustomQuery(DatabaseQuery customQuery)INTERNAL: Set the properties needed to be cascaded into the custom query including the translation row.voidprepareFromQuery(DatabaseQuery query)INTERNAL: Prepare the query from the prepared query.java.lang.BooleanprintInnerJoinInWhereClause()INTERNAL: Indicates whether the query will change the way that inner joins are printed in generated SQL for the database.voidrecordCloneForPessimisticLocking(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Helper method that records clone with uow if query is pessimistic locking.voidrefreshIdentityMapResult()PUBLIC: Refresh the attributes of the object(s) resulting from the query.voidrefreshRemoteIdentityMapResult()PUBLIC: Refresh the attributes of the object(s) resulting from the query.java.lang.ObjectregisterIndividualResult(java.lang.Object result, java.lang.Object primaryKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ClassDescriptor concreteDescriptor)INTERNAL: Constructs the final (registered) object for every individual object queried via a UnitOfWork.booleanrequiresDeferredLocks()INTERNAL: When reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its ownervoidsetExecutionTime(long executionTime)INTERNAL: Set the the time this query went to the database.voidsetLockMode(short lockMode)PUBLIC: Sets whether this is a pessimistically locking query.voidsetPrefetchedCacheKeys(java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys)voidsetPrintInnerJoinInWhereClause(boolean printInnerJoinInWhereClause)INTERNAL: Set a flag that indicates whether the query will change the way that inner joins are printed in generated SQL for the database.voidsetReferenceClass(java.lang.Class aClass)REQUIRED: Set the reference class for the query.voidsetReferenceClassName(java.lang.String aClass)INTERNAL: Set the reference class for the query.voidsetRequiresDeferredLocks(boolean cascadeDeferredLocks)INTERNAL: When reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its ownervoidsetShouldBuildNullForNullPk(boolean shouldBuildNullForNullPk)INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).voidsetShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed.voidsetShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed.voidsetShouldRegisterResultsInUnitOfWork(boolean shouldRegisterResultsInUnitOfWork)INTERNAL: Set to false to have queries conform to a UnitOfWork without registering any additional objects not already in that UnitOfWork.voidsetShouldUseExclusiveConnection(boolean shouldUseExclusiveConnection)ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true EclipseLink will ensure that the query is executed through the exclusive connection.protected voidsetWasDefaultLockMode(boolean wasDefaultLockMode)INTERNAL: Set if this query originally used the default lock mode.booleanshouldBuildNullForNullPk()INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).booleanshouldReadAllMappings()INTERNAL: Return if this is a full object query, not partial nor fetch group.booleanshouldReadMapping(DatabaseMapping mapping, FetchGroup fetchGroup)INTERNAL: Check if the mapping is part of the partial attributes.booleanshouldRefreshIdentityMapResult()PUBLIC: Set to a boolean.booleanshouldRefreshRemoteIdentityMapResult()PUBLIC: Set to a boolean.booleanshouldRegisterResultsInUnitOfWork()INTERNAL: Allows one to do conforming in a UnitOfWork without registering.booleanshouldUseExclusiveConnection()ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true EclipseLink will ensure that the query is executed through the exclusive connection.booleanshouldUseSerializedObjectPolicy()INTERNAL: Indicates whether the query should use SerializedObjectPolicy if descriptor has it.booleanusesResultSetAccessOptimization()INTERNAL: Return if the query uses ResultSet optimization.protected booleanwasDefaultLockMode()INTERNAL: Return if this query originally used the default lock mode.-
Methods inherited from class org.eclipse.persistence.queries.ReadQuery
buildObject, cacheQueryResults, cacheResult, clearQueryResults, doNotCacheQueryResults, getFetchSize, getFirstResult, getInternalMax, getMaxRows, getQueryId, getQueryResults, getQueryResults, getQueryResults, getQueryResultsCachePolicy, getTemporaryCachedQueryResults, isDefaultPropertiesQuery, isReadQuery, prepare, prepareForExecution, remoteExecute, setAllowQueryResultsCacheValidation, setFetchSize, setFirstResult, setInternalMax, setMaxRows, setQueryId, setQueryResults, setQueryResultsCachePolicy, setTemporaryCachedQueryResults, shouldAllowQueryResultsCacheValidation, shouldCacheQueryResults
-
Methods inherited from class org.eclipse.persistence.queries.DatabaseQuery
addArgument, addArgument, addArgument, addArgument, addArgument, addArgument, addArgumentByTypeName, addArgumentValue, addArgumentValues, addCall, addStatement, bindAllParameters, buildArgumentFields, buildSelectionCriteria, cacheStatement, cascadeAllParts, cascadeByMapping, cascadeOnlyDependentParts, cascadePrivateParts, checkDescriptor, checkEarlyReturn, checkForCustomQuery, checkPrepare, checkPrepare, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, execute, executeDatabaseQuery, executeInUnitOfWork, extractRemoteResult, getAccessor, getAccessors, getArgumentParameterTypes, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getBatchObjects, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, getDefaultRedirector, getDescriptor, getDescriptors, getDomainClassNounName, getDoNotRedirect, getEJBQLString, getExecutionSession, getFlushOnExecute, getHintString, getJPQLString, getMonitorName, getName, getNullableArguments, getParameterDelimiter, getParameterDelimiterChar, getPartitioningPolicy, getProperties, getProperty, getQueryMechanism, getQueryNounName, getQueryTimeout, getQueryTimeoutUnit, getRedirector, getRedirectorForQuery, getSelectionCriteria, getSensorName, getSession, getSessionName, getShouldBindAllParameters, getSourceMapping, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, getTranslationRow, hasAccessor, hasArguments, hasNullableArguments, hasProperties, hasQueryMechanism, hasSessionName, ignoreBindAllParameters, ignoreCacheStatement, isCallQuery, isCascadeOfAggregateDelete, isCustomQueryUsed, isCustomSelectionQuery, isDataModifyQuery, isDataReadQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExecutionClone, isExpressionQuery, isInsertObjectQuery, isJPQLCallQuery, isModifyAllQuery, isModifyQuery, isNativeConnectionRequired, isObjectLevelModifyQuery, isObjectLevelReadQuery, isPrepared, isReadAllQuery, isReadObjectQuery, isReportQuery, isResultSetMappingQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isUserDefinedSQLCall, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareForRemoteExecution, prepareInternal, redirectQuery, remoteExecute, removeProperty, replaceValueHoldersIn, resetMonitorName, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setAllowNativeSQLQuery, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setBatchObjects, setCall, setCascadePolicy, setDatasourceCall, setDescriptor, setDoNotRedirect, setEJBQLString, setExecutionSession, setFlushOnExecute, setHintString, setIsCustomQueryUsed, setIsExecutionClone, setIsNativeConnectionRequired, setIsPrepared, setIsUserDefined, setIsUserDefinedSQLCall, setJPQLString, setName, setNullableArguments, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryMechanism, setQueryTimeout, setQueryTimeoutUnit, setRedirector, setSelectionCriteria, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldRetrieveBypassCache, setShouldReturnGeneratedKeys, setShouldStoreBypassCache, setShouldUseWrapperPolicy, setShouldValidateUpdateCallCacheUse, setSourceMapping, setSQLStatement, setSQLString, setTranslationRow, shouldAllowNativeSQLQuery, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldPrepare, shouldRetrieveBypassCache, shouldReturnGeneratedKeys, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, storeBypassCache, toString
-
-
-
-
Field Detail
-
referenceClass
protected java.lang.Class referenceClass
The class of the target objects to be read from the database.
-
referenceClassName
protected java.lang.String referenceClassName
-
shouldRefreshIdentityMapResult
protected boolean shouldRefreshIdentityMapResult
Allows for the resulting objects to be refresh with the data from the database.
-
shouldRefreshRemoteIdentityMapResult
protected boolean shouldRefreshRemoteIdentityMapResult
-
shouldRegisterResultsInUnitOfWork
protected boolean shouldRegisterResultsInUnitOfWork
INTERNAL: for bug 2612601 allow ability not to register results in UOW.
-
lockingClause
protected org.eclipse.persistence.internal.expressions.ForUpdateClause lockingClause
Used for pessimistic locking.
-
NO_LOCK
public static final short NO_LOCK
- See Also:
- Constant Field Values
-
LOCK
public static final short LOCK
- See Also:
- Constant Field Values
-
LOCK_NOWAIT
public static final short LOCK_NOWAIT
- See Also:
- Constant Field Values
-
DEFAULT_LOCK_MODE
public static final short DEFAULT_LOCK_MODE
- See Also:
- Constant Field Values
-
executionTime
protected long executionTime
Used to set the read time on objects that use this query. Should be set to the time the query returned from the database.
-
shouldUseExclusiveConnection
protected boolean shouldUseExclusiveConnection
Added for Exclusive Connection (VPD) support see accessor for information
-
LOCK_RESULT_PROPERTY
public static final java.lang.String LOCK_RESULT_PROPERTY
INTERNAL: This is the key for accessing unregistered and locked result in the query's properties. The uow and QueryBaseValueHolder use this property to record and to retrieve the result respectively.- See Also:
- Constant Field Values
-
wasDefaultLockMode
protected boolean wasDefaultLockMode
PERF: Store if the query originally used the default lock mode.
-
shouldBuildNullForNullPk
protected boolean shouldBuildNullForNullPk
INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).
-
requiresDeferredLocks
protected java.lang.Boolean requiresDeferredLocks
When reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its owner
-
isCacheCheckComplete
protected boolean isCacheCheckComplete
was a check early return completed
-
prefetchedCacheKeys
protected java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys
-
printInnerJoinInWhereClause
protected java.lang.Boolean printInnerJoinInWhereClause
Indicates whether the query printer/normalizer changes the way that inner joins are printed in generated SQL for the database. With a value of true, inner joins are printed in the WHERE clause, if false, inner joins are printed in the FROM clause. If value is set it overrides printInnerJoinInWhereClause persistence unit property. Default value null - value from printInnerJoinInWhereClause persistence unit property is used
-
-
Method Detail
-
clone
public java.lang.Object clone()
INTERNAL: Clone the query- Overrides:
clonein classDatabaseQuery
-
clonedQueryExecutionComplete
protected void clonedQueryExecutionComplete(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query.- Overrides:
clonedQueryExecutionCompletein classReadQuery
-
convertClassNamesToClasses
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this query to actual class-based settings. This method is used when converting a project that has been built with class names to a project with classes.- Overrides:
convertClassNamesToClassesin classDatabaseQuery- Parameters:
classLoader-
-
wasDefaultLockMode
protected boolean wasDefaultLockMode()
INTERNAL: Return if this query originally used the default lock mode.
-
setWasDefaultLockMode
protected void setWasDefaultLockMode(boolean wasDefaultLockMode)
INTERNAL: Set if this query originally used the default lock mode.
-
deepClone
public java.lang.Object deepClone()
INTERNAL: Clone the query, including its selection criteria.Normally selection criteria are not cloned here as they are cloned later on during prepare.
-
copyFromQuery
public void copyFromQuery(DatabaseQuery query)
INTERNAL: Copy all setting from the query. This is used to morph queries from one type to the other. By default this calls prepareFromQuery, but additional properties may be required to be copied as prepareFromQuery only copies properties that affect the SQL.- Overrides:
copyFromQueryin classReadQuery
-
prepareCustomQuery
protected void prepareCustomQuery(DatabaseQuery customQuery)
INTERNAL: Set the properties needed to be cascaded into the custom query including the translation row. This is used only for primary key queries, as the descriptor query manager stores a predefined query for this query to avoid having to re-prepare and allow for customization.- Overrides:
prepareCustomQueryin classDatabaseQuery
-
prepareFromQuery
public void prepareFromQuery(DatabaseQuery query)
INTERNAL: Prepare the query from the prepared query. This allows a dynamic query to prepare itself directly from a prepared query instance. This is used in the EJBQL parse cache to allow preparsed queries to be used to prepare dynamic queries. This only copies over properties that are configured through EJBQL.- Overrides:
prepareFromQueryin classDatabaseQuery
-
dontRefreshIdentityMapResult
public void dontRefreshIdentityMapResult()
PUBLIC: When unset means perform read normally and dont do refresh.
-
dontRefreshRemoteIdentityMapResult
public void dontRefreshRemoteIdentityMapResult()
PUBLIC: When unset means perform read normally and dont do refresh.
-
hasExecutionFetchGroup
public boolean hasExecutionFetchGroup()
INTERNAL: Indicates whether a FetchGroup will be applied to the query.
-
getExecutionFetchGroup
public FetchGroup getExecutionFetchGroup()
INTERNAL: Returns FetchGroup that will be applied to the query. Note that the returned fetchGroup may be updated during preProcess.
-
getExecutionFetchGroup
public FetchGroup getExecutionFetchGroup(ClassDescriptor descriptor)
INTERNAL: Returns FetchGroup that will be applied to the query. Note that the returned fetchGroup may be updated during preProcess.
-
getLoadGroup
public LoadGroup getLoadGroup()
Return the load group set in the query.
-
getLockMode
public short getLockMode()
PUBLIC: Return the current locking mode.
-
getDataResults
public java.util.List getDataResults()
INTERNAL: Return all of the rows fetched by the query, used for 1-m joining.
-
getExecutionTime
public long getExecutionTime()
INTERNAL: Return the time this query actually went to the database
-
getPrefetchedCacheKeys
public java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> getPrefetchedCacheKeys()
-
getQueryPrimaryKey
protected java.lang.Object getQueryPrimaryKey()
INTERNAL: Return the primary key stored in this query if there is one This is overridden by subclasses that actually hold a primary key- Returns:
- See Also:
ReadObjectQuery
-
getReferenceClass
public java.lang.Class getReferenceClass()
PUBLIC: Return the reference class of the query.- Overrides:
getReferenceClassin classDatabaseQuery
-
getReferenceClassName
public java.lang.String getReferenceClassName()
INTERNAL: Return the reference class of the query.- Overrides:
getReferenceClassNamein classDatabaseQuery
-
hasPartialAttributeExpressions
public boolean hasPartialAttributeExpressions()
INTERNAL: Return if partial attributes.
-
isLockQuery
public boolean isLockQuery()
PUBLIC: Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. In the case of DEFAULT_LOCK_MODE and the query reference class being a CMP entity bean, at execution time LOCK, LOCK_NOWAIT, or NO_LOCK will be decided.If a single joined attribute was configured for pessimistic locking then this will return true (after first execution) as the SQL contained a FOR UPDATE OF clause.
-
isObjectBuildingQuery
public boolean isObjectBuildingQuery()
PUBLIC: Return if this is an object building query.- Overrides:
isObjectBuildingQueryin classDatabaseQuery
-
isRegisteringResults
public boolean isRegisteringResults()
INTERNAL: Answers if we are executing through a UnitOfWork and registering results. This is only ever false if using the conforming without registering feature.
-
refreshIdentityMapResult
public void refreshIdentityMapResult()
PUBLIC: Refresh the attributes of the object(s) resulting from the query. If cascading is used the private parts of the objects will also be refreshed.
-
refreshRemoteIdentityMapResult
public void refreshRemoteIdentityMapResult()
PUBLIC: Refresh the attributes of the object(s) resulting from the query. If cascading is used the private parts of the objects will also be refreshed.
-
registerIndividualResult
public java.lang.Object registerIndividualResult(java.lang.Object result, java.lang.Object primaryKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ClassDescriptor concreteDescriptor)INTERNAL: Constructs the final (registered) object for every individual object queried via a UnitOfWork.Called for every object in a read all, the object in a read object, and every time the next or previous row is retrieved from a cursor.
The (conform) without registering feature is implemented here, and may return an original non UnitOfWork registered result.
Pessimistically locked objects are tracked here.
- Returns:
- a refreshed UnitOfWork queried object, unwrapped.
-
postRegisterIndividualResult
public void postRegisterIndividualResult(java.lang.Object clone, java.lang.Object original, java.lang.Object primaryKey, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.queries.JoinedAttributeManager joinManager, ClassDescriptor concreteDescriptor)Post process the object once it is registered in the unit of work.
-
requiresDeferredLocks
public boolean requiresDeferredLocks()
INTERNAL: When reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its owner
-
setExecutionTime
public void setExecutionTime(long executionTime)
INTERNAL: Set the the time this query went to the database.
-
setLockMode
public void setLockMode(short lockMode)
PUBLIC: Sets whether this is a pessimistically locking query.- ObjectBuildingQuery.LOCK: SELECT .... FOR UPDATE issued.
- ObjectBuildingQuery.LOCK_NOWAIT: SELECT .... FOR UPDATE NO WAIT issued.
- ObjectBuildingQuery.NO_LOCK: no pessimistic locking.
- ObjectBuildingQuery.DEFAULT_LOCK_MODE (default) and you have a CMP descriptor: fine grained locking will occur.
Fine Grained Locking: On execution the reference class and those of all joined attributes will be checked. If any of these have a PessimisticLockingPolicy set on their descriptor, they will be locked in a SELECT ... FOR UPDATE OF ... {NO WAIT}. Issues fewer locks and avoids setting the lock mode on each query.
Example:
readAllQuery.setSelectionCriteria(employee.get("address").equal("Ottawa"));- LOCK: all employees in Ottawa and all referenced Ottawa addresses will be locked.
- DEFAULT_LOCK_MODE: if address is a joined attribute, and only address has a pessimistic locking policy, only referenced Ottawa addresses will be locked.
- See Also:
PessimisticLockingPolicy
-
setPrefetchedCacheKeys
public void setPrefetchedCacheKeys(java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys)
-
setReferenceClass
public void setReferenceClass(java.lang.Class aClass)
REQUIRED: Set the reference class for the query.
-
setReferenceClassName
public void setReferenceClassName(java.lang.String aClass)
INTERNAL: Set the reference class for the query.
-
setRequiresDeferredLocks
public void setRequiresDeferredLocks(boolean cascadeDeferredLocks)
INTERNAL: When reading across relationships, queries may be set to acquire deferred locks This is used to ensure any Eagerly fetched object that is the target of a relationship with an object the acquires deferred locks behaves the same as its owner
-
setShouldRefreshIdentityMapResult
public void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. If cascading is used the private parts of the objects will also be refreshed.
-
setShouldRefreshRemoteIdentityMapResult
public void setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. If cascading is used the private parts of the objects will also be refreshed.
-
setShouldRegisterResultsInUnitOfWork
public void setShouldRegisterResultsInUnitOfWork(boolean shouldRegisterResultsInUnitOfWork)
INTERNAL: Set to false to have queries conform to a UnitOfWork without registering any additional objects not already in that UnitOfWork.- See Also:
shouldRegisterResultsInUnitOfWork- Related Bugs:
- 2612601
-
setShouldUseExclusiveConnection
public void setShouldUseExclusiveConnection(boolean shouldUseExclusiveConnection)
ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true EclipseLink will ensure that the query is executed through the exclusive connection. This may be required in certain cases. An example being where database security will prevent a query joining to a secure table from returning the correct results when executed through the shared connection.
-
shouldRegisterResultsInUnitOfWork
public boolean shouldRegisterResultsInUnitOfWork()
INTERNAL: Allows one to do conforming in a UnitOfWork without registering. Queries executed on a UnitOfWork will only return working copies for objects that have already been registered.Extreme care should be taken in using this feature, for a user will get back a mix of registered and original (unregistered) objects.
Best used with a WrapperPolicy where invoking on an object will trigger its registration (CMP). Without a WrapperPolicy
registerExistingObjectshould be called on any object that you intend to change.- Returns:
- true by default.
- See Also:
setShouldRegisterResultsInUnitOfWork(boolean)- Related Bugs:
- 2612601
-
shouldUseExclusiveConnection
public boolean shouldUseExclusiveConnection()
ADVANCED: If the user has isolated data and specified that the client session should use an exclusive connection then by setting this condition to true EclipseLink will ensure that the query is executed through the exclusive connection. This may be required in certain cases. An example being where database security will prevent a query joining to a secure table from returning the correct results when executed through the shared connection.
-
shouldReadAllMappings
public boolean shouldReadAllMappings()
INTERNAL: Return if this is a full object query, not partial nor fetch group.
-
shouldReadMapping
public boolean shouldReadMapping(DatabaseMapping mapping, FetchGroup fetchGroup)
INTERNAL: Check if the mapping is part of the partial attributes.
-
shouldRefreshIdentityMapResult
public boolean shouldRefreshIdentityMapResult()
PUBLIC: Set to a boolean. When set means refresh the instance variables of referenceObject from the database.
-
shouldRefreshRemoteIdentityMapResult
public boolean shouldRefreshRemoteIdentityMapResult()
PUBLIC: Set to a boolean. When set means refresh the instance variables of referenceObject from the database.
-
isAttributeJoined
public boolean isAttributeJoined(ClassDescriptor mappingDescriptor, java.lang.String attributeName)
INTERNAL: Return if the attribute is specified for joining.
-
isCacheCheckComplete
public boolean isCacheCheckComplete()
INTERNAL: Returns true if an early return cache check was completed
-
isClonePessimisticLocked
public boolean isClonePessimisticLocked(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Helper method that checks if clone has been locked with uow.
-
recordCloneForPessimisticLocking
public void recordCloneForPessimisticLocking(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)INTERNAL: Helper method that records clone with uow if query is pessimistic locking.
-
isDefaultLock
public boolean isDefaultLock()
INTERNAL: Helper method to determine the default mode. If true and quey has a pessimistic locking policy, locking will be configured according to the pessimistic locking policy.
-
shouldBuildNullForNullPk
public boolean shouldBuildNullForNullPk()
INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).
-
setShouldBuildNullForNullPk
public void setShouldBuildNullForNullPk(boolean shouldBuildNullForNullPk)
INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception).
-
usesResultSetAccessOptimization
public boolean usesResultSetAccessOptimization()
INTERNAL: Return if the query uses ResultSet optimization.
-
shouldUseSerializedObjectPolicy
public boolean shouldUseSerializedObjectPolicy()
INTERNAL: Indicates whether the query should use SerializedObjectPolicy if descriptor has it.
-
printInnerJoinInWhereClause
public java.lang.Boolean printInnerJoinInWhereClause()
INTERNAL: Indicates whether the query will change the way that inner joins are printed in generated SQL for the database. With a value of true, inner joins are printed in the WHERE clause, if false, inner joins are printed in the FROM clause.
-
setPrintInnerJoinInWhereClause
public void setPrintInnerJoinInWhereClause(boolean printInnerJoinInWhereClause)
INTERNAL: Set a flag that indicates whether the query will change the way that inner joins are printed in generated SQL for the database. With a value of true, inner joins are printed in the WHERE clause, if false, inner joins are printed in the FROM clause.
-
-