- All Implemented Interfaces:
Serializable,Cloneable
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.
- Since:
- TOPLink/Java 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.persistence.queries.DatabaseQuery
DatabaseQuery.ParameterType -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ObjectKey that can be used in place of a selection criteria.protected ObjectObject that can be used in place of a selection criteria.protected booleanCan be used to refresh a specific non-cached instance from the database.Fields inherited from class org.eclipse.persistence.queries.ObjectLevelReadQuery
additionalFields, aggregateQueries, batchFetchPolicy, cacheUsage, CheckCacheByExactPrimaryKey, CheckCacheByPrimaryKey, CheckCacheOnly, CheckCacheThenDatabase, concreteSubclassCalls, concreteSubclassJoinedMappingIndexes, concreteSubclassQueries, ConformResultsInUnitOfWork, defaultBuilder, distinctState, DoNotCheckCache, DONT_USE_DISTINCT, fetchGroup, fetchGroupName, inMemoryQueryIndirectionPolicy, isCachedExpressionQuery, isPrePrepared, isReadOnly, isReferenceClassLocked, isResultSetAccessOptimizedQuery, isResultSetAccessOptimizedQueryDefault, isResultSetOptimizedQuery, joinedAttributeManager, loadGroup, lockModeType, NONE, nonFetchJoinAttributeExpressions, OPTIMISTIC, OPTIMISTIC_FORCE_INCREMENT, orderByExpressions, partialAttributeExpressions, PESSIMISTIC_, PESSIMISTIC_FORCE_INCREMENT, PESSIMISTIC_READ, PESSIMISTIC_WRITE, READ, shouldExtendPessimisticLockScope, shouldIncludeData, shouldOuterJoinSubclasses, shouldUseDefaultFetchGroup, shouldUseSerializedObjectPolicy, shouldUseSerializedObjectPolicyDefault, UNCOMPUTED_DISTINCT, unionExpressions, USE_DISTINCT, UseDescriptorSetting, usesResultSetAccessOptimization, waitTimeout, waitTimeoutUnit, WRITEFields inherited from class org.eclipse.persistence.queries.ObjectBuildingQuery
DEFAULT_LOCK_MODE, executionTime, isCacheCheckComplete, LOCK, LOCK_NOWAIT, LOCK_RESULT_PROPERTY, lockingClause, NO_LOCK, prefetchedCacheKeys, printInnerJoinInWhereClause, referenceClass, referenceClassName, requiresDeferredLocks, shouldBuildNullForNullPk, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseExclusiveConnection, wasDefaultLockModeFields inherited from class org.eclipse.persistence.queries.ReadQuery
allowQueryResultsCacheValidation, fetchSize, firstResult, maxResults, maxRows, queryId, queryResultCachingPolicy, temporaryCachedQueryResultsFields 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
ConstructorsConstructorDescriptionPUBLIC: Return a new read object query.ReadObjectQuery(Class<?> classToRead) PUBLIC: Return a new read object query.ReadObjectQuery(Class<?> classToRead, Expression selectionCriteria) PUBLIC: Return a new read object query for the class and the selection criteria.ReadObjectQuery(Class<?> classToRead, ExpressionBuilder builder) PUBLIC: Return a new read object query for the class.ReadObjectQuery(Class<?> classToRead, Call call) PUBLIC: Return a new read object query.ReadObjectQuery(Object objectToRead) PUBLIC: Return a query to read the object with the same primary key as the provided object.ReadObjectQuery(Object exampleObject, QueryByExamplePolicy policy) PUBLIC: Return a query by example query to find an object matching the attributes of the example object.ReadObjectQuery(ExpressionBuilder builder) PUBLIC: The expression builder should be provide on creation to ensure only one is used.ReadObjectQuery(Call call) PUBLIC: Return a new read object query. -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheResult(Object object) INTERNAL:voidPUBLIC: The cache will be checked only if the query contains exactly the primary key.voidPUBLIC: This is the default, the cache will be checked only if the query contains the primary key.voidPUBLIC: The cache will be checked completely, then if the object is not found or the query too complex the database will be queried.protected BooleancheckCustomQueryFlag(AbstractSession session, AbstractRecord translationRow) INTERNAL: Check and return custom query flag.voidcheckDescriptor(AbstractSession session) INTERNAL: Ensure that the descriptor has been set.protected ObjectcheckEarlyReturnLocal(AbstractSession session, AbstractRecord translationRow) INTERNAL: The cache check is done before the prepare as a hit will not require the work to be done.voidINTERNAL: Clear the selection id and object.protected ObjectconformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord databaseRow, boolean buildDirectlyFromRows) INTERNAL: Conform the result in the UnitOfWork.voidcopyFromQuery(DatabaseQuery query) INTERNAL: Copy all setting from the query.voidPUBLIC: Do not refesh/load into the selection object, this is the default.execute(AbstractSession session, AbstractRecord row) INTERNAL: Execute the query.protected ObjectINTERNAL: Execute the query.protected ObjectINTERNAL: Execute the query building the objects directly from the database result-set.extractRemoteResult(Transporter transporter) INTERNAL: Extract the correct query result from the transporter.protected QueryRedirectorINTERNAL: Returns the specific default redirector for this query type.protected ObjectINTERNAL: Return the primary key stored in this queryprotected ObjectLevelReadQueryINTERNAL: Get custom single object read query from query manager.PUBLIC: Return Id of the object to be selected by the query.PUBLIC: Return the selection object of the query.protected booleanINTERNAL: Return if the query has an non-default fetch group defined for itself.booleanINTERNAL: Return if the query is by primary key.booleanPUBLIC: Return if this is a read object query.voidPUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache.protected voidprepare()INTERNAL: Prepare the receiver for execution in a session.protected voidprepareCustomQuery(DatabaseQuery customQuery) INTERNAL: Set the properties needed to be cascaded into the custom query including the translation row.voidINTERNAL: Prepare the receiver for execution in a session.protected voidINTERNAL: Prepare the receiver for execution in a session.registerResultInUnitOfWork(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows) INTERNAL: All objects queried via a UnitOfWork get registered here.protected ObjectreplaceValueHoldersIn(Object object, RemoteSessionController controller) INTERNAL: replace the value holders in the specified result object(s)voidsetSelectionId(Object id) PUBLIC: The Id of the object to be selected by the query.voidsetSelectionObject(Object selectionObject) PUBLIC: Used to set the where clause of the query.voidsetShouldLoadResultIntoSelectionObject(boolean shouldLoadResultIntoSelectionObject) PUBLIC: Allow for the selection object of the query to be refreshed or put into the EclipseLink cache.booleanPUBLIC: Return if cache should be checked.booleanPUBLIC: Return if cache should be checked.booleanPUBLIC: Return if cache should be checked.booleanPUBLIC: return true if the result should be loaded into the passed in selection ObjectMethods inherited from class org.eclipse.persistence.queries.ObjectLevelReadQuery
acquireLocks, acquireLocksWithoutWaiting, addAdditionalField, addAdditionalField, addBatchReadAttribute, addBatchReadAttribute, addDescendingOrdering, addJoinedAttribute, addJoinedAttribute, addJoinSelectionFields, addNonFetchJoin, addNonFetchJoinedAttribute, addNonFetchJoinedAttribute, addOrdering, addPartialAttribute, addPartialAttribute, addSelectionFieldsForJoinedExpression, addUnionExpression, buildObject, changeDescriptor, checkCacheOnly, checkEarlyReturn, checkForCustomQuery, checkPrepare, checkPrePrepare, clearIsResultSetOptimizedQuery, clearUsesResultSetAccessOptimization, clone, computeBatchReadAttributes, computeBatchReadMappingQueries, computeNestedQueriesForBatchReadExpressions, conformIndividualResult, conformResultsInUnitOfWork, deepClone, dontAcquireLocks, dontCheckCache, dontRefreshIdentityMapResult, dontRefreshRemoteIdentityMapResult, dontUseDistinct, equals, except, executeDatabaseQuery, executeInUnitOfWork, extendPessimisticLockScope, getAdditionalFields, getAggregateQueries, getAggregateQuery, getAsOfClause, getBatchFetchPolicy, getBatchObjects, getBatchReadAttributeExpressions, getCacheUsage, getConcreteSubclassCalls, getConcreteSubclassJoinedMappingIndexes, getConcreteSubclassQueries, getDistinctState, getExampleObject, getExecutionFetchGroup, getExecutionFetchGroup, getExpressionBuilder, getFetchGroup, getFetchGroupName, getFetchGroupNonNestedFieldsSet, getFetchGroupNonNestedFieldsSet, getFetchGroupSelectionFields, getFetchGroupSelectionFields, getInMemoryQueryIndirectionPolicy, getInMemoryQueryIndirectionPolicyState, getJoinedAttributeExpressions, getJoinedAttributeManager, getLoadGroup, getLockingClause, getLockModeType, getNonFetchJoinAttributeExpressions, getOrderByExpressions, getPartialAttributeExpressions, getPartialAttributeSelectionFields, getQueryByExamplePolicy, getReferenceClass, getReferenceClassName, getSelectionFields, getUnionExpressions, getWaitTimeout, getWaitTimeoutUnit, hasAdditionalFields, hasAsOfClause, hasBatchReadAttributes, hasDefaultBuilder, hasExecutionFetchGroup, hasFetchGroup, hashCode, hasJoining, hasNonFetchJoinedAttributeExpressions, hasOrderByExpressions, hasPartialAttributeExpressions, hasUnionExpressions, initializeDefaultBuilder, intersect, isAttributeBatchRead, isCachedExpressionQuery, isClonePessimisticLocked, isDefaultLock, isDefaultPropertiesQuery, isDistinctComputed, isLockQuery, isLockQuery, isObjectLevelReadQuery, isPartialAttribute, isPrePrepared, isReadOnly, isReferenceClassLocked, isResultSetAccessOptimizedQuery, isResultSetOptimizedQuery, prepareFetchGroup, prepareForRemoteExecution, prepareFromCachedQuery, prepareFromQuery, prepareOutsideUnitOfWork, prepareQuery, prepareResultSetAccessOptimization, recordCloneForPessimisticLocking, refreshIdentityMapResult, refreshRemoteIdentityMapResult, resetDistinct, setAdditionalFields, setAggregateQuery, setAsOfClause, setBatchFetchPolicy, setBatchFetchSize, setBatchFetchType, setBatchObjects, setBatchReadAttributeExpressions, setCacheUsage, setDescriptor, setDistinctState, setEJBQLString, setExampleObject, setExpressionBuilder, setFetchGroup, setFetchGroupName, setInMemoryQueryIndirectionPolicy, setInMemoryQueryIndirectionPolicyState, setIsPrepared, setIsPreparedKeepingSubclassData, setIsPrePrepared, setIsReadOnly, setIsResultSetAccessOptimizedQuery, setIsResultSetOptimizedQuery, setJoinedAttributeExpressions, setJoinedAttributeManager, setLoadGroup, setLockingClause, setLockMode, setLockModeType, setNonFetchJoinAttributeExpressions, setOrderByExpressions, setPartialAttributeExpressions, setQueryByExamplePolicy, setReferenceClass, setReferenceClassName, setSelectionCriteria, setShouldExtendPessimisticLockScope, setShouldFilterDuplicates, setShouldIncludeData, setShouldOuterJoinSubclasses, setShouldUseDefaultFetchGroup, setShouldUseSerializedObjectPolicy, setUnionExpressions, setWaitTimeout, setWaitTimeoutUnit, shouldCheckCache, shouldCheckCacheOnly, shouldCheckDescriptorForCacheUsage, shouldConformResultsInUnitOfWork, shouldDistinctBeUsed, shouldExtendPessimisticLockScope, shouldFilterDuplicates, shouldIncludeData, shouldOuterJoinSubclasses, shouldReadAllMappings, shouldReadMapping, shouldUseDefaultFetchGroup, shouldUseSerializedObjectPolicy, supportsResultSetAccessOptimizationOnExecute, supportsResultSetAccessOptimizationOnPrepare, toString, union, useDistinct, usesResultSetAccessOptimizationMethods inherited from class org.eclipse.persistence.queries.ObjectBuildingQuery
clonedQueryExecutionComplete, convertClassNamesToClasses, getDataResults, getExecutionTime, getLockMode, getPrefetchedCacheKeys, isAttributeJoined, isCacheCheckComplete, isObjectBuildingQuery, isRegisteringResults, postRegisterIndividualResult, printInnerJoinInWhereClause, registerIndividualResult, requiresDeferredLocks, setExecutionTime, setPrefetchedCacheKeys, setPrintInnerJoinInWhereClause, setRequiresDeferredLocks, setShouldBuildNullForNullPk, setShouldRefreshIdentityMapResult, setShouldRefreshRemoteIdentityMapResult, setShouldRegisterResultsInUnitOfWork, setShouldUseExclusiveConnection, setWasDefaultLockMode, shouldBuildNullForNullPk, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseExclusiveConnection, wasDefaultLockModeMethods inherited from class org.eclipse.persistence.queries.ReadQuery
cacheQueryResults, clearQueryResults, doNotCacheQueryResults, getFetchSize, getFirstResult, getInternalMax, getMaxRows, getQueryId, getQueryResults, getQueryResults, getQueryResults, getQueryResultsCachePolicy, getTemporaryCachedQueryResults, isReadQuery, remoteExecute, setAllowQueryResultsCacheValidation, setFetchSize, setFirstResult, setInternalMax, setMaxRows, setQueryId, setQueryResults, setQueryResultsCachePolicy, setTemporaryCachedQueryResults, shouldAllowQueryResultsCacheValidation, shouldCacheQueryResultsMethods 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, checkPrepare, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, getAccessor, getAccessors, getArgumentParameterTypes, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, 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, isPrepared, isReadAllQuery, isReportQuery, isResultSetMappingQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isUserDefinedSQLCall, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareInternal, redirectQuery, removeProperty, resetMonitorName, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setAllowNativeSQLQuery, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setCall, setCascadePolicy, setDatasourceCall, setDoNotRedirect, setExecutionSession, setFlushOnExecute, setHintString, setIsCustomQueryUsed, setIsExecutionClone, setIsNativeConnectionRequired, setIsUserDefined, setIsUserDefinedSQLCall, setJPQLString, setName, setNullableArguments, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryMechanism, setQueryTimeout, setQueryTimeoutUnit, setRedirector, 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
-
Field Details
-
selectionObject
Object that can be used in place of a selection criteria. -
selectionId
Key that can be used in place of a selection criteria. -
shouldLoadResultIntoSelectionObject
protected boolean shouldLoadResultIntoSelectionObjectCan be used to refresh a specific non-cached instance from the database.
-
-
Constructor Details
-
ReadObjectQuery
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. -
ReadObjectQuery
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), orReadObjectQuery(Object, QueryByExamplePolicy). -
ReadObjectQuery
PUBLIC: Return a new read object query for the class and the selection criteria. -
ReadObjectQuery
PUBLIC: Return a new read object query for the class. The expression builder must be used for all associated expressions used with the query. -
ReadObjectQuery
PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure. -
ReadObjectQuery
PUBLIC: Return a new read object query. The call represents a database interaction such as SQL, Stored Procedure. -
ReadObjectQuery
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. -
ReadObjectQuery
PUBLIC: Return a query by example query to find an object matching the attributes of the example object. -
ReadObjectQuery
PUBLIC: The expression builder should be provide on creation to ensure only one is used.
-
-
Method Details
-
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.
- Specified by:
cacheResultin classReadQuery
-
checkCacheByExactPrimaryKey
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:
-
checkCacheByPrimaryKey
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:
-
checkCacheThenDatabase
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:
-
checkDescriptor
INTERNAL: Ensure that the descriptor has been set.- Overrides:
checkDescriptorin classObjectLevelReadQuery- Parameters:
session- Current session.- Throws:
QueryException
-
checkEarlyReturnLocal
INTERNAL: The cache check is done before the prepare as a hit will not require the work to be done.- Specified by:
checkEarlyReturnLocalin classObjectLevelReadQuery
-
checkCustomQueryFlag
INTERNAL: Check and return custom query flag. Custom query flag value is initialized when stored value isnull. Called fromObjectLevelReadQuery.checkForCustomQuery(AbstractSession, AbstractRecord)to retrieve custom query flag.- Specified by:
checkCustomQueryFlagin classObjectLevelReadQuery- Parameters:
session- Current session.translationRow- Database record.- Returns:
- Current custom query flag. Value will never be
null.
-
getReadQuery
INTERNAL: Get custom single object read query from query manager. Called fromObjectLevelReadQuery.checkForCustomQuery(AbstractSession, AbstractRecord)to retrieve custom read query.- Specified by:
getReadQueryin classObjectLevelReadQuery- Returns:
- Custom single object read query from query manager.
-
conformResult
protected Object conformResult(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord databaseRow, boolean buildDirectlyFromRows) INTERNAL: Conform the result in the UnitOfWork. -
dontLoadResultIntoSelectionObject
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.
-
execute
INTERNAL: Execute the query. If there are cached results return those. This must override the super to support result caching.- Overrides:
executein classObjectLevelReadQuery- Parameters:
session- the session in which the receiver will be executed.- Returns:
- An object or vector, the result of executing the query.
- Throws:
DatabaseException- - an error has occurred on the database
-
executeObjectLevelReadQuery
INTERNAL: Execute the query. Do a cache lookup and build object from row if required.- Specified by:
executeObjectLevelReadQueryin classObjectLevelReadQuery- Returns:
- object - the first object found or null if none.
- Throws:
DatabaseException- - an error has occurred on the database
-
executeObjectLevelReadQueryFromResultSet
INTERNAL: Execute the query building the objects directly from the database result-set.- Specified by:
executeObjectLevelReadQueryFromResultSetin classObjectLevelReadQuery- Returns:
- object - the first object found or null if none.
- Throws:
DatabaseException- - an error has occurred on the database
-
extractRemoteResult
INTERNAL: Extract the correct query result from the transporter.- Overrides:
extractRemoteResultin classDatabaseQuery
-
getDefaultRedirector
INTERNAL: Returns the specific default redirector for this query type. There are numerous default query redirectors. See ClassDescriptor for their types.- Overrides:
getDefaultRedirectorin classDatabaseQuery
-
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. -
isReadObjectQuery
public boolean isReadObjectQuery()PUBLIC: Return if this is a read object query.- Overrides:
isReadObjectQueryin classDatabaseQuery
-
isPrimaryKeyQuery
public boolean isPrimaryKeyQuery()INTERNAL: Return if the query is by primary key.- Overrides:
isPrimaryKeyQueryin classObjectLevelReadQuery
-
loadResultIntoSelectionObject
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.
-
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.- Overrides:
copyFromQueryin classObjectLevelReadQuery
-
prepare
INTERNAL: Prepare the receiver for execution in a session.- Overrides:
preparein classObjectLevelReadQuery- Throws:
QueryException
-
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.- Overrides:
prepareCustomQueryin classObjectBuildingQuery
-
prepareForExecution
INTERNAL: Prepare the receiver for execution in a session.- Overrides:
prepareForExecutionin classReadQuery- Throws:
QueryException
-
prePrepare
INTERNAL: Prepare the receiver for execution in a session.- Overrides:
prePreparein classObjectLevelReadQuery- Throws:
QueryException
-
registerResultInUnitOfWork
public Object registerResultInUnitOfWork(Object result, UnitOfWorkImpl unitOfWork, AbstractRecord arguments, boolean buildDirectlyFromRows) 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.
- Specified by:
registerResultInUnitOfWorkin classObjectLevelReadQuery- Parameters:
result- may be collection (read all) or an object (read one), or even a cursor. If in transaction the shared cache will be bypassed, meaning the result may not be originals from the parent but raw database rows.unitOfWork- the unitOfWork the result is being registered in.arguments- the original arguments/parameters passed to the query execution. Used by conformingbuildDirectlyFromRows- If in transaction must construct a registered result from raw database rows.- Returns:
- the final (conformed, refreshed, wrapped) UnitOfWork query result
-
remoteExecute
- Overrides:
remoteExecutein classDatabaseQuery
-
replaceValueHoldersIn
INTERNAL: replace the value holders in the specified result object(s)- Overrides:
replaceValueHoldersInin classDatabaseQuery
-
getQueryPrimaryKey
INTERNAL: Return the primary key stored in this query- Overrides:
getQueryPrimaryKeyin classObjectBuildingQuery- Returns:
- the selection id of this ReadObjectQuery
- See Also:
-
getSelectionId
PUBLIC: Return Id of the object to be selected by the query. -
clearSelectionId
public void clearSelectionId()INTERNAL: Clear the selection id and object. This is done after cloning queries to prepare them in inheritance. -
setSelectionId
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:
-
setSelectionObject
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. -
setShouldLoadResultIntoSelectionObject
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.
-
shouldCheckCacheByExactPrimaryKey
public boolean shouldCheckCacheByExactPrimaryKey()PUBLIC: Return if cache should be checked. -
shouldCheckCacheByPrimaryKey
public boolean shouldCheckCacheByPrimaryKey()PUBLIC: Return if cache should be checked. -
shouldCheckCacheThenDatabase
public boolean shouldCheckCacheThenDatabase()PUBLIC: Return if cache should be checked. -
shouldLoadResultIntoSelectionObject
public boolean shouldLoadResultIntoSelectionObject()PUBLIC: return true if the result should be loaded into the passed in selection Object -
hasNonDefaultFetchGroup
protected boolean hasNonDefaultFetchGroup()INTERNAL: Return if the query has an non-default fetch group defined for itself.
-