|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.queries.DatabaseQuery org.eclipse.persistence.queries.ReadQuery org.eclipse.persistence.queries.ObjectBuildingQuery
public abstract class ObjectBuildingQuery
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.
Field Summary | |
---|---|
static short |
DEFAULT_LOCK_MODE
|
protected long |
executionTime
Used to set the read time on objects that use this query. |
protected boolean |
isCacheCheckComplete
was a check early return completed |
static short |
LOCK
|
static short |
LOCK_NOWAIT
|
static java.lang.String |
LOCK_RESULT_PROPERTY
INTERNAL: This is the key for accessing unregistered and locked result in the query's properties. |
protected org.eclipse.persistence.internal.expressions.ForUpdateClause |
lockingClause
Used for pessimistic locking. |
static short |
NO_LOCK
|
protected java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> |
prefetchedCacheKeys
|
protected java.lang.Class |
referenceClass
The class of the target objects to be read from the database. |
protected java.lang.String |
referenceClassName
|
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 |
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). |
protected boolean |
shouldRefreshIdentityMapResult
Allows for the resulting objects to be refresh with the data from the database. |
protected boolean |
shouldRefreshRemoteIdentityMapResult
|
protected boolean |
shouldRegisterResultsInUnitOfWork
INTERNAL: for bug 2612601 allow ability not to register results in UOW. |
protected boolean |
shouldUseExclusiveConnection
Added for Exclusive Connection (VPD) support see accessor for information |
protected boolean |
wasDefaultLockMode
PERF: Store if the query originally used the default lock mode. |
Fields inherited from class org.eclipse.persistence.queries.ReadQuery |
---|
fetchSize, firstResult, maxRows, queryId, queryResultCachingPolicy, temporaryCachedQueryResults |
Constructor Summary | |
---|---|
ObjectBuildingQuery()
INTERNAL: Initialize the state of the query |
Method Summary | |
---|---|
java.lang.Object |
clone()
INTERNAL: Clone the query |
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. |
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this query to actual class-based settings. |
void |
copyFromQuery(DatabaseQuery query)
INTERNAL: Copy all setting from the query. |
java.lang.Object |
deepClone()
INTERNAL: Clone the query, including its selection criteria. |
void |
dontRefreshIdentityMapResult()
PUBLIC: When unset means perform read normally and dont do refresh. |
void |
dontRefreshRemoteIdentityMapResult()
PUBLIC: When unset means perform read normally and dont do refresh. |
java.util.List |
getDataResults()
INTERNAL: Return all of the rows fetched by the query, used for 1-m joining. |
org.eclipse.persistence.internal.queries.EntityFetchGroup |
getEntityFetchGroup()
INTERNAL: Returns EntityFetchGroup that will be applied to objects returned by the query. |
FetchGroup |
getExecutionFetchGroup()
INTERNAL: Returns FetchGroup that will be applied to the query. |
long |
getExecutionTime()
INTERNAL: Return the time this query actually went to the database |
short |
getLockMode()
PUBLIC: Return the current locking mode. |
java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> |
getPrefetchedCacheKeys()
|
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 |
java.lang.Class |
getReferenceClass()
PUBLIC: Return the reference class of the query. |
java.lang.String |
getReferenceClassName()
INTERNAL: Return the reference class of the query. |
boolean |
hasExecutionFetchGroup()
INTERNAL: Indicates whether a FetchGroup will be applied to the query. |
boolean |
hasPartialAttributeExpressions()
INTERNAL: Return if partial attributes. |
boolean |
isAttributeJoined(ClassDescriptor mappingDescriptor,
java.lang.String attributeName)
INTERNAL: Return if the attribute is specified for joining. |
boolean |
isCacheCheckComplete()
INTERNAL: Returns true if an early return cache check was completed |
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. |
boolean |
isDefaultLock()
INTERNAL: Helper method to determine the default mode. |
boolean |
isLockQuery()
PUBLIC: Answers if the query lock mode is known to be LOCK or LOCK_NOWAIT. |
boolean |
isObjectBuildingQuery()
PUBLIC: Return if this is an object building query. |
boolean |
isRegisteringResults()
INTERNAL: Answers if we are executing through a UnitOfWork and registering results. |
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. |
protected void |
prepareCustomQuery(DatabaseQuery customQuery)
INTERNAL: Set the properties needed to be cascaded into the custom query including the translation row. |
void |
prepareFromQuery(DatabaseQuery query)
INTERNAL: Prepare the query from the prepared query. |
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. |
void |
refreshIdentityMapResult()
PUBLIC: Refresh the attributes of the object(s) resulting from the query. |
void |
refreshRemoteIdentityMapResult()
PUBLIC: Refresh the attributes of the object(s) resulting from the query. |
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. |
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 |
void |
setExecutionTime(long executionTime)
INTERNAL: Set the the time this query went to the database. |
void |
setLockMode(short lockMode)
PUBLIC: Sets whether this is a pessimistically locking query. |
void |
setPrefetchedCacheKeys(java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys)
|
void |
setReferenceClass(java.lang.Class aClass)
REQUIRED: Set the reference class for the query. |
void |
setReferenceClassName(java.lang.String aClass)
INTERNAL: Set the reference class for the query. |
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 |
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). |
void |
setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. |
void |
setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
PUBLIC: Set if the attributes of the object(s) resulting from the query should be refreshed. |
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. |
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. |
protected void |
setWasDefaultLockMode(boolean wasDefaultLockMode)
INTERNAL: Set if this query originally used the default lock mode. |
boolean |
shouldBuildNullForNullPk()
INTERNAL: If primary key is null ObjectBuilder.buildObject returns null in case this flag is set to true (instead of throwing exception). |
boolean |
shouldReadAllMappings()
INTERNAL: Return if this is a full object query, not partial nor fetch group. |
boolean |
shouldReadMapping(DatabaseMapping mapping)
INTERNAL: Check if the mapping is part of the partial attributes. |
boolean |
shouldRefreshIdentityMapResult()
PUBLIC: Set to a boolean. |
boolean |
shouldRefreshRemoteIdentityMapResult()
PUBLIC: Set to a boolean. |
boolean |
shouldRegisterResultsInUnitOfWork()
INTERNAL: Allows one to do conforming in a UnitOfWork without registering. |
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 boolean |
wasDefaultLockMode()
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, getMaxRows, getQueryId, getQueryResults, getQueryResults, getQueryResults, getQueryResultsCachePolicy, getTemporaryCachedQueryResults, isDefaultPropertiesQuery, isReadQuery, prepare, prepareForExecution, remoteExecute, setFetchSize, setFirstResult, setMaxRows, setQueryId, setQueryResults, setQueryResultsCachePolicy, setTemporaryCachedQueryResults, shouldCacheQueryResults |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.Class referenceClass
protected java.lang.String referenceClassName
protected boolean shouldRefreshIdentityMapResult
protected boolean shouldRefreshRemoteIdentityMapResult
protected boolean shouldRegisterResultsInUnitOfWork
protected org.eclipse.persistence.internal.expressions.ForUpdateClause lockingClause
public static final short NO_LOCK
public static final short LOCK
public static final short LOCK_NOWAIT
public static final short DEFAULT_LOCK_MODE
protected long executionTime
protected boolean shouldUseExclusiveConnection
public static final java.lang.String LOCK_RESULT_PROPERTY
protected boolean wasDefaultLockMode
protected boolean shouldBuildNullForNullPk
protected java.lang.Boolean requiresDeferredLocks
protected boolean isCacheCheckComplete
protected java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys
Constructor Detail |
---|
public ObjectBuildingQuery()
Method Detail |
---|
public java.lang.Object clone()
clone
in class DatabaseQuery
protected void clonedQueryExecutionComplete(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
clonedQueryExecutionComplete
in class ReadQuery
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
convertClassNamesToClasses
in class DatabaseQuery
classLoader
- protected boolean wasDefaultLockMode()
protected void setWasDefaultLockMode(boolean wasDefaultLockMode)
public java.lang.Object deepClone()
Normally selection criteria are not cloned here as they are cloned later on during prepare.
public void copyFromQuery(DatabaseQuery query)
copyFromQuery
in class ReadQuery
protected void prepareCustomQuery(DatabaseQuery customQuery)
prepareCustomQuery
in class DatabaseQuery
public void prepareFromQuery(DatabaseQuery query)
prepareFromQuery
in class DatabaseQuery
public void dontRefreshIdentityMapResult()
public void dontRefreshRemoteIdentityMapResult()
public boolean hasExecutionFetchGroup()
public FetchGroup getExecutionFetchGroup()
public org.eclipse.persistence.internal.queries.EntityFetchGroup getEntityFetchGroup()
public short getLockMode()
public java.util.List getDataResults()
public long getExecutionTime()
public java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> getPrefetchedCacheKeys()
protected java.lang.Object getQueryPrimaryKey()
ReadObjectQuery
public java.lang.Class getReferenceClass()
getReferenceClass
in class DatabaseQuery
public java.lang.String getReferenceClassName()
getReferenceClassName
in class DatabaseQuery
public boolean hasPartialAttributeExpressions()
public boolean isLockQuery()
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.
public boolean isObjectBuildingQuery()
isObjectBuildingQuery
in class DatabaseQuery
public boolean isRegisteringResults()
public void refreshIdentityMapResult()
public void refreshRemoteIdentityMapResult()
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)
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.
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)
public boolean requiresDeferredLocks()
public void setExecutionTime(long executionTime)
public void setLockMode(short lockMode)
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"));
PessimisticLockingPolicy
public void setPrefetchedCacheKeys(java.util.Map<java.lang.Object,org.eclipse.persistence.internal.identitymaps.CacheKey> prefetchedCacheKeys)
public void setReferenceClass(java.lang.Class aClass)
public void setReferenceClassName(java.lang.String aClass)
public void setRequiresDeferredLocks(boolean cascadeDeferredLocks)
public void setShouldRefreshIdentityMapResult(boolean shouldRefreshIdentityMapResult)
public void setShouldRefreshRemoteIdentityMapResult(boolean shouldRefreshIdentityMapResult)
public void setShouldRegisterResultsInUnitOfWork(boolean shouldRegisterResultsInUnitOfWork)
shouldRegisterResultsInUnitOfWork
public void setShouldUseExclusiveConnection(boolean shouldUseExclusiveConnection)
public boolean shouldRegisterResultsInUnitOfWork()
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 registerExistingObject
should be called on any object that you intend to change.
setShouldRegisterResultsInUnitOfWork(boolean)
public boolean shouldUseExclusiveConnection()
public boolean shouldReadAllMappings()
public boolean shouldReadMapping(DatabaseMapping mapping)
public boolean shouldRefreshIdentityMapResult()
public boolean shouldRefreshRemoteIdentityMapResult()
public boolean isAttributeJoined(ClassDescriptor mappingDescriptor, java.lang.String attributeName)
public boolean isCacheCheckComplete()
public boolean isClonePessimisticLocked(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
public void recordCloneForPessimisticLocking(java.lang.Object clone, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl uow)
public boolean isDefaultLock()
public boolean shouldBuildNullForNullPk()
public void setShouldBuildNullForNullPk(boolean shouldBuildNullForNullPk)
|
EclipseLink 2.4.2, build 'v20130514-5956486' API Reference | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |