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

public Class ReadObjectQuery

extends ObjectLevelReadQuery
Class Inheritance
Imports
java.sql.ResultSet, .ResultSetMetaData, .SQLException, .Statement, java.util.IdentityHashMap, .List, .Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.DatabaseException, .QueryException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.internal.databaseaccess.Accessor, .DatabaseAccessor, .DatabaseCall, .DatabasePlatform, org.eclipse.persistence.internal.descriptors.ObjectBuilder, org.eclipse.persistence.internal.helper.InvalidObject, org.eclipse.persistence.internal.identitymaps.CacheId, org.eclipse.persistence.internal.indirection.ProxyIndirectionPolicy, org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, .ResultSetRecord, .SimpleResultSetRecord, .UnitOfWorkImpl, org.eclipse.persistence.internal.sessions.remote.RemoteSessionController, .Transporter, org.eclipse.persistence.sessions.DatabaseRecord, .SessionProfiler, org.eclipse.persistence.sessions.remote.DistributedSession, org.eclipse.persistence.tools.profiler.QueryMonitor

Purpose: Concrete class for all read queries involving a single object.

Responsibilities: Return a single object for the query. Implements the inheritance feature when dealing with abstract descriptors.

Author
Yvon Lavoie
Since
TOPLink/Java 1.0

Field Summary

Modifier and TypeField and Description
protected Object
selectionId

Key that can be used in place of a selection criteria.

protected transient Object
selectionObject

Object that can be used in place of a selection criteria.

protected boolean
shouldLoadResultIntoSelectionObject

Can be used to refresh a specific non-cached instance from the database.

Inherited from org.eclipse.persistence.queries.ObjectLevelReadQuery:
additionalFieldsaggregateQueriesbatchFetchPolicycacheUsageCheckCacheByExactPrimaryKeyCheckCacheByPrimaryKeyCheckCacheOnlyCheckCacheThenDatabaseconcreteSubclassCallsconcreteSubclassJoinedMappingIndexesconcreteSubclassQueriesConformResultsInUnitOfWorkdefaultBuilderdistinctStateDoNotCheckCacheDONT_USE_DISTINCTfetchGroupfetchGroupNameinMemoryQueryIndirectionPolicyisCachedExpressionQueryisPrePreparedisReadOnlyisReferenceClassLockedisResultSetAccessOptimizedQueryisResultSetAccessOptimizedQueryDefaultisResultSetOptimizedQueryjoinedAttributeManagerloadGrouplockModeTypeNONEnonFetchJoinAttributeExpressionsOPTIMISTICOPTIMISTIC_FORCE_INCREMENTorderByExpressionspartialAttributeExpressionsPESSIMISTIC_PESSIMISTIC_FORCE_INCREMENTPESSIMISTIC_READPESSIMISTIC_WRITEREADshouldExtendPessimisticLockScopeshouldIncludeDatashouldOuterJoinSubclassesshouldUseDefaultFetchGroupshouldUseSerializedObjectPolicyshouldUseSerializedObjectPolicyDefaultUNCOMPUTED_DISTINCTunionExpressionsUSE_DISTINCTUseDescriptorSettingusesResultSetAccessOptimizationwaitTimeoutwaitTimeoutUnitWRITE

Constructor Summary

AccessConstructor and Description
public
ReadObjectQuery()

PUBLIC: Return a new read object query.

public
ReadObjectQuery(Class<?> classToRead)

PUBLIC: Return a new read object query.

public
ReadObjectQuery(Class<?> classToRead, Expression selectionCriteria)

PUBLIC: Return a new read object query for the class and the selection criteria.

public
ReadObjectQuery(Class<?> classToRead, ExpressionBuilder builder)

PUBLIC: Return a new read object query for the class.

public
ReadObjectQuery(Class<?> classToRead, Call call)

PUBLIC: Return a new read object query.

public
ReadObjectQuery(Call call)

PUBLIC: Return a new read object query.

public
ReadObjectQuery(Object objectToRead)

PUBLIC: Return a query to read the object with the same primary key as the provided object.

public
ReadObjectQuery(Object exampleObject, QueryByExamplePolicy policy)

PUBLIC: Return a query by example query to find an object matching the attributes of the example object.

public
ReadObjectQuery(ExpressionBuilder builder)

PUBLIC: The expression builder should be provide on creation to ensure only one is used.

Method Summary

Modifier and TypeMethod and Description
public void
cacheResult(Object object)

Implements abstract org.eclipse.persistence.queries.ReadQuery.cacheResult.

INTERNAL:

This method is called by the object builder when building an original.

public void
checkCacheByExactPrimaryKey()

PUBLIC: The cache will be checked only if the query contains exactly the primary key.

public void
checkCacheByPrimaryKey()

PUBLIC: This is the default, the cache will be checked only if the query contains the primary key.

public void
checkCacheThenDatabase()

PUBLIC: The cache will be checked completely, then if the object is not found or the query too complex the database will be queried.

protected Boolean

Returns:

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

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.checkCustomQueryFlag.

INTERNAL: Check and return custom query flag.
public void
checkDescriptor(AbstractSession
Current session.
session
)

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor.

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

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturnLocal.

INTERNAL: The cache check is done before the prepare as a hit will not require the work to be done.
public void
clearSelectionId()

INTERNAL: Clear the selection id and object.

protected Object
conformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord databaseRow, boolean buildDirectlyFromRows)

INTERNAL: Conform the result in the UnitOfWork.

public void
copyFromQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.copyFromQuery.

INTERNAL: Copy all setting from the query.
public void
dontLoadResultIntoSelectionObject()

PUBLIC: Do not refesh/load into the selection object, this is the default.

public Object

Returns:

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

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.execute.

INTERNAL: Execute the query.
protected Object

Returns:

object - the first object found or null if none.
executeObjectLevelReadQuery
()

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.executeObjectLevelReadQuery.

INTERNAL: Execute the query.
protected Object

Returns:

object - the first object found or null if none.
executeObjectLevelReadQueryFromResultSet
()

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.executeObjectLevelReadQueryFromResultSet.

INTERNAL: Execute the query building the objects directly from the database result-set.
public Object
extractRemoteResult(Transporter transporter)

Overrides org.eclipse.persistence.queries.DatabaseQuery.extractRemoteResult.

INTERNAL: Extract the correct query result from the transporter.
protected QueryRedirector
getDefaultRedirector()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getDefaultRedirector.

INTERNAL: Returns the specific default redirector for this query type.
protected Object

Returns:

the selection id of this ReadObjectQuery
getQueryPrimaryKey
()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getQueryPrimaryKey.

INTERNAL: Return the primary key stored in this query
protected ObjectLevelReadQuery

Returns:

Custom single object read query from query manager.
getReadQuery
()

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.getReadQuery.

INTERNAL: Get custom single object read query from query manager.
public Object
getSelectionId()

PUBLIC: Return Id of the object to be selected by the query.

public Object
getSelectionObject()

PUBLIC: Return the selection object of the query.

protected boolean
hasNonDefaultFetchGroup()

INTERNAL: Return if the query has an non-default fetch group defined for itself.

public boolean
isPrimaryKeyQuery()

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.isPrimaryKeyQuery.

INTERNAL: Return if the query is by primary key.
public boolean
isReadObjectQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isReadObjectQuery.

PUBLIC: Return if this is a read object query.
public void
loadResultIntoSelectionObject()

PUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache.

protected void
prepare()

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.
protected void
prepareCustomQuery(DatabaseQuery customQuery)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.prepareCustomQuery.

INTERNAL: Set the properties needed to be cascaded into the custom query including the translation row.
public void
prepareForExecution()

Overrides org.eclipse.persistence.queries.ReadQuery.prepareForExecution.

INTERNAL: Prepare the receiver for execution in a session.
protected void
prePrepare()

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.prePrepare.

INTERNAL: Prepare the receiver for execution in a session.
public 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
)

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.registerResultInUnitOfWork.

INTERNAL: All objects queried via a UnitOfWork get registered here.
protected Object
public Map<K, V>
replaceValueHoldersIn(Object object, RemoteSessionController controller)

Overrides org.eclipse.persistence.queries.DatabaseQuery.replaceValueHoldersIn.

INTERNAL: replace the value holders in the specified result object(s)
public void
setSelectionId(Object id)

PUBLIC: The Id of the object to be selected by the query.

public void
setSelectionObject(Object selectionObject)

PUBLIC: Used to set the where clause of the query.

public void
setShouldLoadResultIntoSelectionObject(boolean shouldLoadResultIntoSelectionObject)

PUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache.

public boolean
shouldCheckCacheByExactPrimaryKey()

PUBLIC: Return if cache should be checked.

public boolean
shouldCheckCacheByPrimaryKey()

PUBLIC: Return if cache should be checked.

public boolean
shouldCheckCacheThenDatabase()

PUBLIC: Return if cache should be checked.

public boolean
shouldLoadResultIntoSelectionObject()

PUBLIC: return true if the result should be loaded into the passed in selection Object

Inherited from org.eclipse.persistence.queries.ObjectLevelReadQuery:
acquireLocksacquireLocksWithoutWaitingaddAdditionalFieldaddAdditionalFieldaddBatchReadAttributeaddBatchReadAttributeaddDescendingOrderingaddJoinedAttributeaddJoinedAttributeaddJoinSelectionFieldsaddNonFetchJoinaddNonFetchJoinedAttributeaddNonFetchJoinedAttributeaddOrderingaddPartialAttributeaddPartialAttributeaddSelectionFieldsForJoinedExpressionaddUnionExpressionbuildObjectchangeDescriptorcheckCacheOnlycheckEarlyReturncheckForCustomQuerycheckPreparecheckPrePrepareclearIsResultSetOptimizedQueryclearUsesResultSetAccessOptimizationclonecomputeBatchReadAttributescomputeBatchReadMappingQueriescomputeNestedQueriesForBatchReadExpressionsconformIndividualResultconformResultsInUnitOfWorkdeepClonedontAcquireLocksdontCheckCachedontRefreshIdentityMapResultdontRefreshRemoteIdentityMapResultdontUseDistinctequalsexceptexecuteDatabaseQueryexecuteInUnitOfWorkextendPessimisticLockScopegetAdditionalFieldsgetAggregateQueriesgetAggregateQuerygetAsOfClausegetBatchFetchPolicygetBatchObjectsgetBatchReadAttributeExpressionsgetCacheUsagegetConcreteSubclassCallsgetConcreteSubclassJoinedMappingIndexesgetConcreteSubclassQueriesgetDistinctStategetExampleObjectgetExecutionFetchGroupgetExecutionFetchGroupgetExpressionBuildergetFetchGroupgetFetchGroupNamegetFetchGroupNonNestedFieldsSetgetFetchGroupNonNestedFieldsSetgetFetchGroupSelectionFieldsgetFetchGroupSelectionFieldsgetInMemoryQueryIndirectionPolicygetInMemoryQueryIndirectionPolicyStategetJoinedAttributeExpressionsgetJoinedAttributeManagergetLoadGroupgetLockingClausegetLockModeTypegetNonFetchJoinAttributeExpressionsgetOrderByExpressionsgetPartialAttributeExpressionsgetPartialAttributeSelectionFieldsgetQueryByExamplePolicygetReferenceClassgetReferenceClassNamegetSelectionFieldsgetUnionExpressionsgetWaitTimeoutgetWaitTimeoutUnithasAdditionalFieldshasAsOfClausehasBatchReadAttributeshasDefaultBuilderhasExecutionFetchGrouphasFetchGrouphashCodehasJoininghasNonFetchJoinedAttributeExpressionshasOrderByExpressionshasPartialAttributeExpressionshasUnionExpressionsinitializeDefaultBuilderintersectisAttributeBatchReadisCachedExpressionQueryisClonePessimisticLockedisDefaultLockisDefaultPropertiesQueryisDistinctComputedisLockQueryisLockQueryisObjectLevelReadQueryisPartialAttributeisPrePreparedisReadOnlyisReferenceClassLockedisResultSetAccessOptimizedQueryisResultSetOptimizedQueryprepareFetchGroupprepareForRemoteExecutionprepareFromCachedQueryprepareFromQueryprepareOutsideUnitOfWorkprepareQueryprepareResultSetAccessOptimizationrecordCloneForPessimisticLockingrefreshIdentityMapResultrefreshRemoteIdentityMapResultresetDistinctsetAdditionalFieldssetAggregateQuerysetAsOfClausesetBatchFetchPolicysetBatchFetchSizesetBatchFetchTypesetBatchObjectssetBatchReadAttributeExpressionssetCacheUsagesetDescriptorsetDistinctStatesetEJBQLStringsetExampleObjectsetExpressionBuildersetFetchGroupsetFetchGroupNamesetInMemoryQueryIndirectionPolicysetInMemoryQueryIndirectionPolicyStatesetIsPreparedsetIsPreparedKeepingSubclassDatasetIsPrePreparedsetIsReadOnlysetIsResultSetAccessOptimizedQuerysetIsResultSetOptimizedQuerysetJoinedAttributeExpressionssetJoinedAttributeManagersetLoadGroupsetLockingClausesetLockModesetLockModeTypesetNonFetchJoinAttributeExpressionssetOrderByExpressionssetPartialAttributeExpressionssetQueryByExamplePolicysetReferenceClasssetReferenceClassNamesetSelectionCriteriasetShouldExtendPessimisticLockScopesetShouldFilterDuplicatessetShouldIncludeDatasetShouldOuterJoinSubclassessetShouldUseDefaultFetchGroupsetShouldUseSerializedObjectPolicysetUnionExpressionssetWaitTimeoutsetWaitTimeoutUnitshouldCheckCacheshouldCheckCacheOnlyshouldCheckDescriptorForCacheUsageshouldConformResultsInUnitOfWorkshouldDistinctBeUsedshouldExtendPessimisticLockScopeshouldFilterDuplicatesshouldIncludeDatashouldOuterJoinSubclassesshouldReadAllMappingsshouldReadMappingshouldUseDefaultFetchGroupshouldUseSerializedObjectPolicysupportsResultSetAccessOptimizationOnExecutesupportsResultSetAccessOptimizationOnPreparetoStringunionuseDistinctusesResultSetAccessOptimization

Field Detail

selectionIdback to summary
protected Object selectionId

Key that can be used in place of a selection criteria.

selectionObjectback to summary
protected transient Object selectionObject

Object that can be used in place of a selection criteria.

shouldLoadResultIntoSelectionObjectback to summary
protected boolean shouldLoadResultIntoSelectionObject

Can be used to refresh a specific non-cached instance from the database.

Constructor Detail

ReadObjectQueryback to summary
public ReadObjectQuery()

PUBLIC: Return a new read object query. A reference class must be specified before execution. It is better to provide the class and expression builder on construction to esnure a single expression builder is used. If no selection criteria is specified this will reads the first object found in the database.

ReadObjectQueryback to summary
public ReadObjectQuery(Class<?> classToRead)

PUBLIC: Return a new read object query. By default, the query has no selection criteria. Executing this query without selection criteria will always result in a database access to read the first instance of the specified Class found in the database. This is true no matter how cache usage is configured and even if an instance of the specified Class exists in the cache. Executing a query with selection criteria allows you to avoid a database access if the selected instance is in the cache. For this reason, you may whish to use a ReadObjectQuery constructor that takes selection criteria, such as: ReadObjectQuery(Class, Call), ReadObjectQuery(Class, Expression), ReadObjectQuery(Class, ExpressionBuilder), ReadObjectQuery(ExpressionBuilder), ReadObjectQuery(Object), or ReadObjectQuery(Object, QueryByExamplePolicy).

ReadObjectQueryback to summary
public ReadObjectQuery(Class<?> classToRead, Expression selectionCriteria)

PUBLIC: Return a new read object query for the class and the selection criteria.

ReadObjectQueryback to summary
public ReadObjectQuery(Class<?> classToRead, ExpressionBuilder builder)

PUBLIC: Return a new read object query for the class. The expression builder must be used for all associated expressions used with the query.

ReadObjectQueryback to summary
public ReadObjectQuery(Class<?> classToRead, Call call)

PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure.

ReadObjectQueryback to summary
public ReadObjectQuery(Call call)

PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure.

ReadObjectQueryback to summary
public ReadObjectQuery(Object objectToRead)

PUBLIC: Return a query to read the object with the same primary key as the provided object.

Note

This is not a query by example object, only the primary key will be used for the selection criteria.

ReadObjectQueryback to summary
public ReadObjectQuery(Object exampleObject, QueryByExamplePolicy policy)

PUBLIC: Return a query by example query to find an object matching the attributes of the example object.

ReadObjectQueryback to summary
public ReadObjectQuery(ExpressionBuilder builder)

PUBLIC: The expression builder should be provide on creation to ensure only one is used.

Method Detail

cacheResultback to summary
public void cacheResult(Object object)

Implements abstract org.eclipse.persistence.queries.ReadQuery.cacheResult.

INTERNAL:

This method is called by the object builder when building an original. It will cause the original to be cached in the query results if the query is set to do so.

Annotations
@Override
checkCacheByExactPrimaryKeyback to summary
public void checkCacheByExactPrimaryKey()

PUBLIC: The cache will be checked only if the query contains exactly the primary key. Queries can be configured to use the cache at several levels. Other caching option are available.

See Also
setCacheUsage(int)
checkCacheByPrimaryKeyback to summary
public void checkCacheByPrimaryKey()

PUBLIC: This is the default, the cache will be checked only if the query contains the primary key. Queries can be configured to use the cache at several levels. Other caching option are available.

See Also
setCacheUsage(int)
checkCacheThenDatabaseback to summary
public void checkCacheThenDatabase()

PUBLIC: The cache will be checked completely, then if the object is not found or the query too complex the database will be queried. Queries can be configured to use the cache at several levels. Other caching option are available.

See Also
setCacheUsage(int)
checkCustomQueryFlagback to summary
protected Boolean checkCustomQueryFlag(final AbstractSession session, final AbstractRecord translationRow)

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.checkCustomQueryFlag.

INTERNAL: Check and return custom query flag. Custom query flag value is initialized when stored value is null. Called from checkForCustomQuery(AbstractSession, AbstractRecord) to retrieve custom query flag.

Parameters
session:AbstractSession

Current session.

translationRow:AbstractRecord

Database record.

Returns:Boolean

Current custom query flag. Value will never be null.

Annotations
@Override
checkDescriptorback to summary
public void checkDescriptor(AbstractSession session) throws QueryException

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor.

INTERNAL: Ensure that the descriptor has been set.

Parameters
session:AbstractSession

Doc from org.eclipse.persistence.queries.ObjectLevelReadQuery.checkDescriptor.

Current session.

Annotations
@Override
checkEarlyReturnLocalback to summary
protected Object checkEarlyReturnLocal(AbstractSession session, AbstractRecord translationRow)

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.checkEarlyReturnLocal.

INTERNAL: The cache check is done before the prepare as a hit will not require the work to be done.

Annotations
@Override
clearSelectionIdback to summary
public void clearSelectionId()

INTERNAL: Clear the selection id and object. This is done after cloning queries to prepare them in inheritance.

conformResultback to summary
protected Object conformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord databaseRow, boolean buildDirectlyFromRows)

INTERNAL: Conform the result in the UnitOfWork.

copyFromQueryback to summary
public void copyFromQuery(DatabaseQuery query)

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.copyFromQuery.

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.

Annotations
@Override
dontLoadResultIntoSelectionObjectback to summary
public void dontLoadResultIntoSelectionObject()

PUBLIC: Do not refesh/load into the selection object, this is the default. This property allows for the selection object of the query to be refreshed or put into the TopLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

Note

This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be refering to the old object.

executeback to summary
public Object execute(AbstractSession session, AbstractRecord row) throws DatabaseException

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.execute.

INTERNAL: Execute the query. If there are cached results return those. This must override the super to support result caching.

Parameters
session:AbstractSession

the session in which the receiver will be executed.

Returns:Object

An object or vector, the result of executing the query.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database
executeObjectLevelReadQueryback to summary
protected Object executeObjectLevelReadQuery() throws DatabaseException

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.executeObjectLevelReadQuery.

INTERNAL: Execute the query. Do a cache lookup and build object from row if required.

Returns:Object

object - the first object found or null if none.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database
executeObjectLevelReadQueryFromResultSetback to summary
protected Object executeObjectLevelReadQueryFromResultSet() throws DatabaseException

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.executeObjectLevelReadQueryFromResultSet.

INTERNAL: Execute the query building the objects directly from the database result-set.

Returns:Object

object - the first object found or null if none.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database
extractRemoteResultback to summary
public Object extractRemoteResult(Transporter transporter)

Overrides org.eclipse.persistence.queries.DatabaseQuery.extractRemoteResult.

INTERNAL: Extract the correct query result from the transporter.

Annotations
@Override
getDefaultRedirectorback to summary
protected QueryRedirector getDefaultRedirector()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getDefaultRedirector.

INTERNAL: Returns the specific default redirector for this query type. There are numerous default query redirectors. See ClassDescriptor for their types.

Annotations
@Override
getQueryPrimaryKeyback to summary
protected Object getQueryPrimaryKey()

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.getQueryPrimaryKey.

INTERNAL: Return the primary key stored in this query

Returns:Object

the selection id of this ReadObjectQuery

Annotations
@Override
getReadQueryback to summary
protected ObjectLevelReadQuery getReadQuery()

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.getReadQuery.

INTERNAL: Get custom single object read query from query manager. Called from checkForCustomQuery(AbstractSession, AbstractRecord) to retrieve custom read query.

Returns:ObjectLevelReadQuery

Custom single object read query from query manager.

Annotations
@Override
getSelectionIdback to summary
public Object getSelectionId()

PUBLIC: Return Id of the object to be selected by the query.

getSelectionObjectback to summary
public Object getSelectionObject()

PUBLIC: Return the selection object of the query. This can be used instead of a where clause expression for single object primary key queries. The selection object given should have a primary key defined, this primary key will be used to query the database instance of the same object. This is a basic form of query by example where only the primary key is required, it can be used for simple query forms, or testing.

hasNonDefaultFetchGroupback to summary
protected boolean hasNonDefaultFetchGroup()

INTERNAL: Return if the query has an non-default fetch group defined for itself.

isPrimaryKeyQueryback to summary
public boolean isPrimaryKeyQuery()

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.isPrimaryKeyQuery.

INTERNAL: Return if the query is by primary key.

Annotations
@Override
isReadObjectQueryback to summary
public boolean isReadObjectQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isReadObjectQuery.

PUBLIC: Return if this is a read object query.

Annotations
@Override
loadResultIntoSelectionObjectback to summary
public void loadResultIntoSelectionObject()

PUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

Note

This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be referring to the old object.

prepareback to summary
protected void prepare() throws QueryException

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.

Annotations
@Override
prepareCustomQueryback to summary
protected void prepareCustomQuery(DatabaseQuery customQuery)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.prepareCustomQuery.

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.

Annotations
@Override
prepareForExecutionback to summary
public void prepareForExecution() throws QueryException

Overrides org.eclipse.persistence.queries.ReadQuery.prepareForExecution.

INTERNAL: Prepare the receiver for execution in a session.

Annotations
@Override
prePrepareback to summary
protected void prePrepare() throws QueryException

Overrides org.eclipse.persistence.queries.ObjectLevelReadQuery.prePrepare.

INTERNAL: Prepare the receiver for execution in a session.

Annotations
@Override
registerResultInUnitOfWorkback to summary
public Object registerResultInUnitOfWork(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows)

Implements abstract org.eclipse.persistence.queries.ObjectLevelReadQuery.registerResultInUnitOfWork.

INTERNAL: All objects queried via a UnitOfWork get registered here. If the query went to the database.

Involves registering the query result individually and in totality, and hence refreshing / conforming is done here.

Parameters
result: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.

unitOfWork:UnitOfWorkImpl

the unitOfWork the result is being registered in.

arguments:AbstractRecord

the original arguments/parameters passed to the query execution. Used by conforming

buildDirectlyFromRows:boolean

If in transaction must construct a registered result from raw database rows.

Returns:Object

the final (conformed, refreshed, wrapped) UnitOfWork query result

Annotations
@Override
remoteExecuteback to summary
protected Object remoteExecute()

Overrides org.eclipse.persistence.queries.DatabaseQuery.remoteExecute.

Annotations
@Override
replaceValueHoldersInback to summary
public Map<K, V> replaceValueHoldersIn(Object object, RemoteSessionController controller)

Overrides org.eclipse.persistence.queries.DatabaseQuery.replaceValueHoldersIn.

INTERNAL: replace the value holders in the specified result object(s)

Annotations
@Override
setSelectionIdback to summary
public void setSelectionId(Object id)

PUBLIC: The Id of the object to be selected by the query. This will generate a query by primary key. This can be used instead of an Expression, SQL, or JPQL, or example object. The Id is the Id value for a singleton primary key, for a composite it is an instance of CacheId.

See Also
CacheId
setSelectionObjectback to summary
public void setSelectionObject(Object selectionObject)

PUBLIC: Used to set the where clause of the query. This can be used instead of a where clause expression for single object primary key queries. The selection object given should have a primary key defined, this primary key will be used to query the database instance of the same object. This is a basic form of query by example where only the primary key is required, it can be used for simple query forms, or testing.

setShouldLoadResultIntoSelectionObjectback to summary
public void setShouldLoadResultIntoSelectionObject(boolean shouldLoadResultIntoSelectionObject)

PUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache. By default on a read or refresh the object in the cache is refreshed and returned or a new object is built from the database, in some cases such as EJB BMP it is desirable to refresh or load into the object passed into the read object query.

Note

This forces the selection object into the cache a replaces any existing object that may already be there, this is a strict violation of object identity and other objects can still be referring to the old object.

shouldCheckCacheByExactPrimaryKeyback to summary
public boolean shouldCheckCacheByExactPrimaryKey()

PUBLIC: Return if cache should be checked.

shouldCheckCacheByPrimaryKeyback to summary
public boolean shouldCheckCacheByPrimaryKey()

PUBLIC: Return if cache should be checked.

shouldCheckCacheThenDatabaseback to summary
public boolean shouldCheckCacheThenDatabase()

PUBLIC: Return if cache should be checked.

shouldLoadResultIntoSelectionObjectback to summary
public boolean shouldLoadResultIntoSelectionObject()

PUBLIC: return true if the result should be loaded into the passed in selection Object