org.eclipse.persistence.queries
Class ResultSetMappingQuery
java.lang.Object
org.eclipse.persistence.queries.DatabaseQuery
org.eclipse.persistence.queries.ReadQuery
org.eclipse.persistence.queries.ObjectBuildingQuery
org.eclipse.persistence.queries.ResultSetMappingQuery
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable
public class ResultSetMappingQuery
- extends ObjectBuildingQuery
Purpose:
Concrete class to perform read using raw SQL and the SQLResultSetMapping.
Responsibilities:
Execute a selecting raw SQL string.
Returns a List of results. Each item in the list will be another list
consisting of the expected populated return types in the order they were
specified in the SQLResultSetMapping
- See Also:
SQLResultSetMapping
,
Serialized Form- Author:
- Gordon Yorke
- Since:
- TopLink Java Essentials
Fields inherited from class org.eclipse.persistence.queries.ObjectBuildingQuery |
DEFAULT_LOCK_MODE, executionTime, LOCK, LOCK_NOWAIT, LOCK_RESULT_PROPERTY, lockingClause, NO_LOCK, referenceClass, referenceClassName, requiresDeferredLocks, shouldBuildNullForNullPk, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseExclusiveConnection, wasDefaultLockMode |
Fields inherited from class org.eclipse.persistence.queries.DatabaseQuery |
accessors, argumentFields, arguments, argumentTypeNames, argumentTypes, argumentValues, BATCH_FETCH_PROPERTY, CascadeAggregateDelete, CascadeAllParts, CascadeByMapping, CascadeDependentParts, cascadePolicy, CascadePrivateParts, descriptor, doNotRedirect, executionSession, flushOnExecute, hintString, isCustomQueryUsed, isExecutionClone, isNativeConnectionRequired, isPrepared, isUserDefined, monitorName, name, NoCascading, parameterDelimiter, partitioningPolicy, properties, queryMechanism, queryTimeout, redirector, session, sessionName, shouldBindAllParameters, shouldCacheStatement, shouldCloneCall, shouldMaintainCache, shouldPrepare, shouldRetrieveBypassCache, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, sourceMapping, translationRow |
Method Summary |
protected java.util.List |
buildObjectsFromRecords(java.util.List databaseRecords)
INTERNAL:
This method is used to build the results. |
void |
cacheResult(java.lang.Object unwrappedOriginal)
INTERNAL:
This method is called by the object builder when building an original. |
java.lang.Object |
clone()
INTERNAL:
Clone the query. |
void |
convertClassNamesToClasses(java.lang.ClassLoader classLoader)
INTERNAL:
Convert all the class-name-based settings in this ResultSetMapping to actual class-based
settings. |
java.lang.Object |
executeDatabaseQuery()
INTERNAL:
Executes the prepared query on the datastore. |
SQLResultSetMapping |
getSQLResultSetMapping()
PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results |
java.lang.String |
getSQLResultSetMappingName()
PUBLIC:
Return the result set mapping name. |
protected void |
prepare()
INTERNAL:
Prepare the receiver for execution in a session. |
void |
setSQLResultSetMapping(SQLResultSetMapping resultSetMapping)
PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results |
void |
setSQLResultSetMappingName(java.lang.String name)
PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results |
Methods inherited from class org.eclipse.persistence.queries.ObjectBuildingQuery |
copyFromQuery, deepClone, dontRefreshIdentityMapResult, dontRefreshRemoteIdentityMapResult, getDataResults, getEntityFetchGroup, getExecutionFetchGroup, getExecutionTime, getLockMode, getReferenceClass, getReferenceClassName, hasExecutionFetchGroup, hasPartialAttributeExpressions, isAttributeJoined, isClonePessimisticLocked, isDefaultLock, isLockQuery, isObjectBuildingQuery, isRegisteringResults, postRegisterIndividualResult, prepareFromQuery, recordCloneForPessimisticLocking, refreshIdentityMapResult, refreshRemoteIdentityMapResult, registerIndividualResult, requiresDeferredLocks, setExecutionTime, setLockMode, setReferenceClass, setReferenceClassName, setRequiresDeferredLocks, setShouldBuildNullForNullPk, setShouldRefreshIdentityMapResult, setShouldRefreshRemoteIdentityMapResult, setShouldRegisterResultsInUnitOfWork, setShouldUseExclusiveConnection, setWasDefaultLockMode, shouldBuildNullForNullPk, shouldReadAllMappings, shouldReadMapping, shouldRefreshIdentityMapResult, shouldRefreshRemoteIdentityMapResult, shouldRegisterResultsInUnitOfWork, shouldUseExclusiveConnection, wasDefaultLockMode |
Methods inherited from class org.eclipse.persistence.queries.ReadQuery |
buildObject, cacheQueryResults, clearQueryResults, clonedQueryExecutionComplete, doNotCacheQueryResults, getFetchSize, getFirstResult, getMaxRows, getQueryId, getQueryResults, getQueryResults, getQueryResults, getQueryResultsCachePolicy, getTemporaryCachedQueryResults, isDefaultPropertiesQuery, isReadQuery, prepareForExecution, remoteExecute, setFetchSize, setFirstResult, setMaxRows, setQueryId, setQueryResults, setQueryResultsCachePolicy, setTemporaryCachedQueryResults, shouldCacheQueryResults |
Methods inherited from class org.eclipse.persistence.queries.DatabaseQuery |
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, executeInUnitOfWork, extractRemoteResult, getAccessor, getAccessors, getArguments, getArgumentTypeNames, getArgumentTypes, getArgumentValues, getBatchObjects, getCall, getCascadePolicy, getDatasourceCall, getDatasourceCalls, getDefaultRedirector, getDescriptor, getDoNotRedirect, getEJBQLString, getExecutionSession, getFlushOnExecute, getHintString, getJPQLString, getMonitorName, getName, getParameterDelimiter, getParameterDelimiterChar, getPartitioningPolicy, getProperties, getProperty, getQueryMechanism, getQueryTimeout, getRedirector, getSelectionCriteria, getSession, getSessionName, getShouldBindAllParameters, getSourceMapping, getSQLStatement, getSQLString, getSQLStrings, getTranslatedSQLString, getTranslatedSQLStrings, getTranslationRow, hasAccessor, hasArguments, 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, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isValueReadQuery, isWriteObjectQuery, maintainCache, prepareCall, prepareCustomQuery, prepareForRemoteExecution, redirectQuery, remoteExecute, removeProperty, replaceValueHoldersIn, resetMonitorName, retrieveBypassCache, rowFromArguments, setAccessor, setAccessors, setArguments, setArgumentTypeNames, setArgumentTypes, setArgumentValues, setBatchObjects, setCall, setCascadePolicy, setDatasourceCall, setDescriptor, setDoNotRedirect, setEJBQLString, setExecutionSession, setFlushOnExecute, setHintString, setIsCustomQueryUsed, setIsExecutionClone, setIsNativeConnectionRequired, setIsPrepared, setIsUserDefined, setJPQLString, setName, setParameterDelimiter, setPartitioningPolicy, setProperties, setProperty, setQueryMechanism, setQueryTimeout, setRedirector, setSelectionCriteria, setSession, setSessionName, setShouldBindAllParameters, setShouldBindAllParameters, setShouldCacheStatement, setShouldMaintainCache, setShouldPrepare, setShouldRetrieveBypassCache, setShouldStoreBypassCache, setShouldUseWrapperPolicy, setShouldValidateUpdateCallCacheUse, setSourceMapping, setSQLStatement, setSQLString, setTranslationRow, shouldBindAllParameters, shouldCacheStatement, shouldCascadeAllParts, shouldCascadeByMapping, shouldCascadeOnlyDependentParts, shouldCascadeParts, shouldCascadePrivateParts, shouldCloneCall, shouldIgnoreBindAllParameters, shouldIgnoreCacheStatement, shouldMaintainCache, shouldPrepare, shouldRetrieveBypassCache, shouldStoreBypassCache, shouldUseWrapperPolicy, shouldValidateUpdateCallCacheUse, storeBypassCache, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
resultSetMappingName
protected java.lang.String resultSetMappingName
resultSetMapping
protected SQLResultSetMapping resultSetMapping
ResultSetMappingQuery
public ResultSetMappingQuery()
- PUBLIC:
Initialize the state of the query.
ResultSetMappingQuery
public ResultSetMappingQuery(Call call)
- PUBLIC:
Initialize the query to use the specified call.
ResultSetMappingQuery
public ResultSetMappingQuery(Call call,
java.lang.String sqlResultSetMappingName)
- PUBLIC:
Initialize the query to use the specified call and SQLResultSetMapping
cacheResult
public void cacheResult(java.lang.Object unwrappedOriginal)
- 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:
cacheResult
in class ReadQuery
clone
public java.lang.Object clone()
- INTERNAL:
Clone the query.
- Overrides:
clone
in class DatabaseQuery
convertClassNamesToClasses
public void convertClassNamesToClasses(java.lang.ClassLoader classLoader)
- INTERNAL:
Convert all the class-name-based settings in this ResultSetMapping 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:
convertClassNamesToClasses
in class ObjectBuildingQuery
- Parameters:
classLoader
-
setSQLResultSetMapping
public void setSQLResultSetMapping(SQLResultSetMapping resultSetMapping)
- PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
setSQLResultSetMappingName
public void setSQLResultSetMappingName(java.lang.String name)
- PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
buildObjectsFromRecords
protected java.util.List buildObjectsFromRecords(java.util.List databaseRecords)
- INTERNAL:
This method is used to build the results. Interpreting the
SQLResultSetMapping.
executeDatabaseQuery
public java.lang.Object executeDatabaseQuery()
throws DatabaseException
- INTERNAL:
Executes the prepared query on the datastore.
- Specified by:
executeDatabaseQuery
in class DatabaseQuery
- Returns:
- - the result of executing the query.
- Throws:
DatabaseException
- - an error has occurred on the database.
prepare
protected void prepare()
- INTERNAL:
Prepare the receiver for execution in a session.
- Overrides:
prepare
in class ReadQuery
getSQLResultSetMapping
public SQLResultSetMapping getSQLResultSetMapping()
- PUBLIC:
This will be the SQLResultSetMapping that is used by this query to process
the database results
getSQLResultSetMappingName
public java.lang.String getSQLResultSetMappingName()
- PUBLIC:
Return the result set mapping name.