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

public Class ResultSetMappingQuery

extends ObjectBuildingQuery
Class Inheritance
Imports
java.util.ArrayList, .Iterator, .List, .Map, .Vector, org.eclipse.persistence.exceptions.DatabaseException, .QueryException, org.eclipse.persistence.internal.databaseaccess.DatabaseCall, org.eclipse.persistence.internal.localization.ExceptionLocalization, org.eclipse.persistence.internal.sessions.UnitOfWorkImpl, org.eclipse.persistence.sessions.DatabaseRecord

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

Author
Gordon Yorke
Since
TopLink Java Essentials
See Also
SQLResultSetMapping

Field Summary

Modifier and TypeField and Description
protected boolean
protected Vector<E>
protected List<String>
protected List<SQLResultSetMapping>
protected boolean
Inherited from org.eclipse.persistence.queries.ObjectBuildingQuery:
DEFAULT_LOCK_MODEexecutionTimeisCacheCheckCompleteLOCKLOCK_NOWAITLOCK_RESULT_PROPERTYlockingClauseNO_LOCKprefetchedCacheKeysprintInnerJoinInWhereClausereferenceClassreferenceClassNamerequiresDeferredLocksshouldBuildNullForNullPkshouldRefreshIdentityMapResultshouldRefreshRemoteIdentityMapResultshouldRegisterResultsInUnitOfWorkshouldUseExclusiveConnectionwasDefaultLockMode

Constructor Summary

AccessConstructor and Description
public
ResultSetMappingQuery()

PUBLIC: Initialize the state of the query.

public
ResultSetMappingQuery(Call call)

PUBLIC: Initialize the query to use the specified call.

public
ResultSetMappingQuery(Call call, String sqlResultSetMappingName)

PUBLIC: Initialize the query to use the specified call and SQLResultSetMapping

Method Summary

Modifier and TypeMethod and Description
public void
addSQLResultSetMapping(SQLResultSetMapping resultSetMapping)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

public void
addSQLResultSetMappingName(String name)

PUBLIC: Add a SQLResultSetMapping that is used by this query to process the database results.

public List<E>
buildObjectsFromRecords(List<E> databaseRecords)

INTERNAL: This method is used to build the results.

public List<E>
buildObjectsFromRecords(List<E> databaseRecords, int index)

INTERNAL: This method is used to build the results with the SQLResultSetMapping at the given index.

protected List<E>
buildObjectsFromRecords(List<E> databaseRecords, SQLResultSetMapping mapping)

INTERNAL: This method is used to build the results.

public void
cacheResult(Object unwrappedOriginal)

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

INTERNAL:

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

public void
convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.convertClassNamesToClasses.

INTERNAL: Convert all the class-name-based settings in this ResultSetMapping to actual class-based settings.
public Object
executeDatabaseQuery()

Implements abstract org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

INTERNAL: Executes the prepared query on the datastore.
public SQLResultSetMapping
getSQLResultSetMapping()

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

public String
getSQLResultSetMappingName()

PUBLIC: Return the result set mapping name.

public List<String>
getSQLResultSetMappingNames()

PUBLIC: Return the result set mapping name.

public List<SQLResultSetMapping>
getSQLResultSetMappings()

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

public boolean
hasResultSetMappings()

PUBLIC: Return true if there are results set mappings associated with this query.

public boolean
isResultSetMappingQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isResultSetMappingQuery.

PUBLIC: Return true if this is a result set mapping query.
protected void
prepare()

Overrides org.eclipse.persistence.queries.ReadQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.
public void
setIsExecuteCall(boolean isExecuteCall)

PUBLIC: Set to true if you the actual jdbc result set returned from query execution.

public void
setShouldReturnNameValuePairs(boolean returnNameValuePairs)

Set the flag that indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.

public void
setSQLResultSetMapping(SQLResultSetMapping resultSetMapping)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

public void
setSQLResultSetMappingName(String name)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

public void
setSQLResultSetMappingNames(List<String> names)

PUBLIC: This will be the SQLResult

public void
setSQLResultSetMappings(List<SQLResultSetMapping> resultSetMappings)

PUBLIC: This will be the SQLResultSetMappings that are used by this query to process the database results

public boolean
shouldReturnNameValuePairs()

Indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.

Inherited from org.eclipse.persistence.queries.ObjectBuildingQuery:
cloneclonedQueryExecutionCompletecopyFromQuerydeepClonedontRefreshIdentityMapResultdontRefreshRemoteIdentityMapResultgetDataResultsgetExecutionFetchGroupgetExecutionFetchGroupgetExecutionTimegetLoadGroupgetLockModegetPrefetchedCacheKeysgetQueryPrimaryKeygetReferenceClassgetReferenceClassNamehasExecutionFetchGrouphasPartialAttributeExpressionsisAttributeJoinedisCacheCheckCompleteisClonePessimisticLockedisDefaultLockisLockQueryisObjectBuildingQueryisRegisteringResultspostRegisterIndividualResultprepareCustomQueryprepareFromQueryprintInnerJoinInWhereClauserecordCloneForPessimisticLockingrefreshIdentityMapResultrefreshRemoteIdentityMapResultregisterIndividualResultrequiresDeferredLockssetExecutionTimesetLockModesetPrefetchedCacheKeyssetPrintInnerJoinInWhereClausesetReferenceClasssetReferenceClassNamesetRequiresDeferredLockssetShouldBuildNullForNullPksetShouldRefreshIdentityMapResultsetShouldRefreshRemoteIdentityMapResultsetShouldRegisterResultsInUnitOfWorksetShouldUseExclusiveConnectionsetWasDefaultLockModeshouldBuildNullForNullPkshouldReadAllMappingsshouldReadMappingshouldRefreshIdentityMapResultshouldRefreshRemoteIdentityMapResultshouldRegisterResultsInUnitOfWorkshouldUseExclusiveConnectionshouldUseSerializedObjectPolicyusesResultSetAccessOptimizationwasDefaultLockMode

Field Detail

isExecuteCallback to summary
protected boolean isExecuteCall
resultRowsback to summary
protected Vector<E> resultRows
resultSetMappingNamesback to summary
protected List<String> resultSetMappingNames
resultSetMappingsback to summary
protected List<SQLResultSetMapping> resultSetMappings
returnNameValuePairsback to summary
protected boolean returnNameValuePairs

Constructor Detail

ResultSetMappingQueryback to summary
public ResultSetMappingQuery()

PUBLIC: Initialize the state of the query.

ResultSetMappingQueryback to summary
public ResultSetMappingQuery(Call call)

PUBLIC: Initialize the query to use the specified call.

ResultSetMappingQueryback to summary
public ResultSetMappingQuery(Call call, String sqlResultSetMappingName)

PUBLIC: Initialize the query to use the specified call and SQLResultSetMapping

Method Detail

addSQLResultSetMappingback to summary
public void addSQLResultSetMapping(SQLResultSetMapping resultSetMapping)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

addSQLResultSetMappingNameback to summary
public void addSQLResultSetMappingName(String name)

PUBLIC: Add a SQLResultSetMapping that is used by this query to process the database results.

buildObjectsFromRecordsback to summary
public List<E> buildObjectsFromRecords(List<E> databaseRecords)

INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping(s).

buildObjectsFromRecordsback to summary
public List<E> buildObjectsFromRecords(List<E> databaseRecords, int index)

INTERNAL: This method is used to build the results with the SQLResultSetMapping at the given index.

buildObjectsFromRecordsback to summary
protected List<E> buildObjectsFromRecords(List<E> databaseRecords, SQLResultSetMapping mapping)

INTERNAL: This method is used to build the results. Interpreting the SQLResultSetMapping.

cacheResultback to summary
public void cacheResult(Object unwrappedOriginal)

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
convertClassNamesToClassesback to summary
public void convertClassNamesToClasses(ClassLoader classLoader)

Overrides org.eclipse.persistence.queries.ObjectBuildingQuery.convertClassNamesToClasses.

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.

Annotations
@Override
executeDatabaseQueryback to summary
public Object executeDatabaseQuery() throws DatabaseException

Implements abstract org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

INTERNAL: Executes the prepared query on the datastore.

Returns:Object

Doc from org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

- the result of executing the query.

Annotations
@Override
Exceptions
DatabaseException:

Doc from org.eclipse.persistence.queries.DatabaseQuery.executeDatabaseQuery.

- an error has occurred on the database.

getSQLResultSetMappingback to summary
public SQLResultSetMapping getSQLResultSetMapping()

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

getSQLResultSetMappingNameback to summary
public String getSQLResultSetMappingName()

PUBLIC: Return the result set mapping name.

getSQLResultSetMappingNamesback to summary
public List<String> getSQLResultSetMappingNames()

PUBLIC: Return the result set mapping name.

getSQLResultSetMappingsback to summary
public List<SQLResultSetMapping> getSQLResultSetMappings()

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

hasResultSetMappingsback to summary
public boolean hasResultSetMappings()

PUBLIC: Return true if there are results set mappings associated with this query.

isResultSetMappingQueryback to summary
public boolean isResultSetMappingQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isResultSetMappingQuery.

PUBLIC: Return true if this is a result set mapping query.

Annotations
@Override
prepareback to summary
protected void prepare()

Overrides org.eclipse.persistence.queries.ReadQuery.prepare.

INTERNAL: Prepare the receiver for execution in a session.

Annotations
@Override
setIsExecuteCallback to summary
public void setIsExecuteCall(boolean isExecuteCall)

PUBLIC: Set to true if you the actual jdbc result set returned from query execution. This will unprepare the query in case it was executed previously for a getResultList() call instead (or vice versa)

setShouldReturnNameValuePairsback to summary
public void setShouldReturnNameValuePairs(boolean returnNameValuePairs)

Set the flag that indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.

setSQLResultSetMappingback to summary
public void setSQLResultSetMapping(SQLResultSetMapping resultSetMapping)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

setSQLResultSetMappingNameback to summary
public void setSQLResultSetMappingName(String name)

PUBLIC: This will be the SQLResultSetMapping that is used by this query to process the database results

setSQLResultSetMappingNamesback to summary
public void setSQLResultSetMappingNames(List<String> names)

PUBLIC: This will be the SQLResult

setSQLResultSetMappingsback to summary
public void setSQLResultSetMappings(List<SQLResultSetMapping> resultSetMappings)

PUBLIC: This will be the SQLResultSetMappings that are used by this query to process the database results

shouldReturnNameValuePairsback to summary
public boolean shouldReturnNameValuePairs()

Indicates whether or not to return populated DatabaseRecord(s) as opposed to raw data when an SQLResultSetMapping is not set.