Purpose: Abstract class for all database query objects. DatabaseQuery is a visible class to the EclipseLink user. Users create an appropriate query by creating an instance of a concrete subclasses of DatabaseQuery.
Responsibilities:
| Modifier and Type | Class and Description |
|---|---|
| public static enum | DatabaseQuery.ParameterType
Used for parameter retreival in JPQL |
| Modifier and Type | Field and Description |
|---|---|
| protected transient Collection | accessors
Connection to use for database access, required for server session connection pooling. |
| protected Boolean | allowNativeSQLQuery
Property used to override a persistence unit level that disallows native SQL queries. |
| protected List | argumentFields
PERF: Argument fields are cached in prepare to avoid rebuilding on each execution. |
| protected List | |
| protected List | arguments
Arguments can be given and specified to predefined queries to allow reuse. |
| protected List | argumentTypeNames
Used to build a list of argumentTypes by name pre-initialization |
| protected List | argumentTypes
Needed to differentiate queries with the same name. |
| protected List | argumentValues
Arguments values can be given and specified to predefined queries to allow reuse. |
| public static final String | BATCH_FETCH_PROPERTY
INTERNAL: Property used for batch fetching in non object queries. |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| protected int | cascadePolicy
Policy that determines how the query will cascade to its object's parts. |
| public static final int | |
| protected transient ClassDescriptor | descriptor
The descriptor cached on the prepare for object level queries. |
| protected List | descriptors
The list of descriptors this query deals with. |
| protected boolean | doNotRedirect
Can be set to true in the case there is a redirector or a default redirector but the user does not want the query redirected. |
| protected transient AbstractSession | executionSession
Only used after the query is cloned for execution to store the execution session under which the query was executed. |
| protected Boolean | |
| protected String | hintString
Used for adding hints to the query string in oracle |
| protected volatile Boolean | isCustomQueryUsed
PERF: Store if this query will use the descriptor custom query. |
| protected boolean | isExecutionClone
PERF: Determines if the query has already been cloned for execution, to avoid duplicate cloning. |
| protected boolean | isNativeConnectionRequired
Allow connection unwrapping to be configured. |
| protected boolean | isPrepared
Queries prepare common stated in themselves. |
| protected boolean | isUserDefined
Internal flag used to bypass user define queries when executing one for custom sql/query support. |
| protected boolean | isUserDefinedSQLCall
Internal flag used to bypass user define queries when executing one for custom sql/query support. |
| protected transient String | monitorName
Return the name to use for the query in performance monitoring. |
| protected String | name
Queries can be given a name and registered with a descriptor to allow common queries to be reused. |
| public static final int | |
| protected List | nullableArguments
List of arguments to check for null. |
| protected String | parameterDelimiter
Allow the reserved pound char used to delimit bind parameters to be overridden |
| protected PartitioningPolicy | partitioningPolicy
Allow queries to be targeted at specific connection pools. |
| protected Map | properties
Internally used by the mappings as a temporary store. |
| protected DatabaseQueryMechanism | queryMechanism
The query mechanism determines the mechanism on how the database will be accessed. |
| protected int | queryTimeout
queryTimeout has three possible settings: DefaultTimeout, NoTimeout, and 1..N This applies to both DatabaseQuery.queryTimeout and DescriptorQueryManager.queryTimeout DatabaseQuery.queryTimeout: - DefaultTimeout: get queryTimeout from DescriptorQueryManager - NoTimeout, 1..N: overrides queryTimeout in DescriptorQueryManager DescriptorQueryManager.queryTimeout: - DefaultTimeout: get queryTimeout from parent DescriptorQueryManager. |
| protected TimeUnit | |
| protected QueryRedirector | redirector
A redirector allows for a queries execution to be the execution of a piece of code. |
| protected transient AbstractSession | session
Only used after the query is cloned for execution to store the session under which the query was executed. |
| protected String | sessionName
Used to override the default session in the session broker. |
| protected Boolean | shouldBindAllParameters
Bind all arguments to the SQL statement. |
| protected Boolean | shouldCacheStatement
Cache the prepared statement, this requires full parameter binding as well. |
| protected boolean | shouldCloneCall
Used to indicate whether or not the call needs to be cloned. |
| protected boolean | shouldMaintainCache
Flag used for a query to bypass the identitymap and unit of work. |
| protected boolean | shouldPrepare
Allow for the prepare of queries to be turned off, this allow for dynamic non-pre SQL generated queries. |
| protected boolean | shouldRetrieveBypassCache
JPA flags to control the shared cache |
| protected boolean | |
| protected boolean | |
| protected boolean | shouldUseWrapperPolicy
Use the WrapperPolicy for the objects returned by the query |
| protected boolean | shouldValidateUpdateCallCacheUse
Allow additional validation to be performed before using the update call cache |
| protected DatabaseMapping | sourceMapping
Table per class requires multiple query executions. |
| protected AbstractRecord | translationRow
Mappings and the descriptor use parameterized mechanisms that will be translated with the data from the row. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | addArgument(String argumentName, Class<?> type)
PUBLIC: Add the argument named argumentName and its class type. |
| public void | addArgument(String argumentName, Class<?> type, DatabaseQuery.
INTERNAL: Add the argument named argumentName. |
| public void | addArgument(String argumentName, Class<?> type, boolean nullable)
PUBLIC: Add the argument named argumentName and its class type. |
| public void | addArgument(String argumentName, Class<?> type, DatabaseQuery.
INTERNAL: Add the argument named argumentName. |
| public void | addArgument(String argumentName, String typeAsString)
PUBLIC: Add the argument named argumentName and its class type. |
| public void | addArgumentByTypeName(String argumentName, String typeAsString)
INTERNAL: Add an argument to the query, but do not resolve the class yet. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public List | buildArgumentFields()
INTERNAL: Build the list of arguments fields from the argument names and types. |
| protected void | buildSelectionCriteria(AbstractSession session)
INTERNAL: In the case of EJBQL, an expression needs to be generated. |
| public void | cacheStatement()
PUBLIC: Cache the prepared statements, this requires full parameter binding as well. |
| public void | cascadeAllParts()
PUBLIC: Cascade the query and its properties on the queries object(s) and all objects related to the queries object(s). |
| public void | cascadeByMapping()
PUBLIC: Cascade the query and its properties on the queries object(s) and all related objects where the mapping has been set to cascade the merge. |
| public void | |
| public void | cascadePrivateParts()
PUBLIC: Cascade the query and its properties on the queries object(s) and all privately owned objects related to the queries object(s). |
| public void | |
| public Object | checkEarlyReturn(AbstractSession session, AbstractRecord translationRow)
INTERNAL: Check to see if this query already knows the return value without performing any further work. |
| protected DatabaseQuery | checkForCustomQuery(AbstractSession session, AbstractRecord translationRow)
INTERNAL: Check to see if a custom query should be used for this query. |
| public void | checkPrepare(AbstractSession session, AbstractRecord translationRow)
INTERNAL: Check to see if this query needs to be prepare and prepare it. |
| public void | checkPrepare(AbstractSession session, AbstractRecord translationRow, boolean force)
INTERNAL: Check to see if this query needs to be prepare and prepare it. |
| public Object | |
| protected void | clonedQueryExecutionComplete(DatabaseQuery query, AbstractSession session)
INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query. |
| public void | convertClassNamesToClasses(ClassLoader classLoader)
INTERNAL: Convert all the class-name-based settings in this query to actual class-based settings This method is implemented by subclasses as necessary. |
| public void | |
| public void | |
| public void | dontCacheStatement()
PUBLIC: Don't cache the prepared statements, this requires full parameter binding as well. |
| public void | dontCascadeParts()
PUBLIC: Do not cascade the query and its properties on the queries object(s) relationships. |
| public void | |
| public Object | Returns: An object, the result of executing the query.- the session in which the receiver will be executed. session, AbstractRecord translationRow)INTERNAL: Execute the query. |
| public abstract Object | |
| public Object | Returns: An object, the result of executing the query.- the session in which the receiver will be executed. unitOfWork, AbstractRecord - the arguments translationRow)INTERNAL: Override query execution where Session is a UnitOfWork. |
| public Object | extractRemoteResult(Transporter transporter)
INTERNAL: Extract the correct query result from the transporter. |
| public Accessor | |
| public Collection | |
| public List | |
| public List | |
| public List | getArgumentTypeNames()
INTERNAL: Return the argumentTypeNames for use with the pre-defined query option These are used pre-initialization to construct the argumentTypes list. |
| public List | |
| public List | |
| public Map | |
| public DatabaseCall | |
| public int | |
| public Call | |
| public List | |
| protected QueryRedirector | |
| public ClassDescriptor | |
| public List | getDescriptors()
INTERNAL: This is here only for JPA queries and currently only populated for JPA queries. |
| public String | |
| public boolean | |
| public String | |
| public AbstractSession | |
| public Boolean | getFlushOnExecute()
PUBLIC: If executed against a RepeatableWriteUnitOfWork if this attribute is true EclipseLink will write changes to the database before executing the query. |
| public String | |
| public String | |
| public String | |
| public String | |
| public List | |
| public String | |
| public char | |
| public PartitioningPolicy | |
| public Map | |
| public synchronized Object | getProperty(Object property)
INTERNAL: Property support used by mappings to store temporary stuff in the query. |
| public DatabaseQueryMechanism | |
| public String | getQueryNounName(String sessionName)
INTERNAL: TopLink_sessionName_domainClass_queryClass_queryName (if exist). |
| public int | getQueryTimeout()
PUBLIC: Return the number of seconds the driver will wait for a Statement to execute to the given number of seconds. |
| public TimeUnit | getQueryTimeoutUnit()
PUBLIC: Return the unit of time the driver will wait for a Statement to execute. |
| public QueryRedirector | |
| public QueryRedirector | |
| public Class | |
| public String | |
| public Expression | |
| public String | getSensorName(String operationName, String sessionName)
INTERNAL: TopLink_sessionName_domainClass_queryClass_queryName (if exist)_operationName (if exist). |
| public AbstractSession | |
| public String | |
| public Boolean | getShouldBindAllParameters()
INTERNAL: Returns the internal tri-state value of shouldBindParameters used far cascading these settings |
| public DatabaseMapping | |
| public SQLStatement | |
| public String | |
| public List | |
| public String | getTranslatedSQLString(Session session, DataRecord translationRow)
ADVANCED: This can be used to access a queries translated SQL if they have been prepared, (i.e. query.prepareCall()). |
| public List | getTranslatedSQLStrings(Session session, DataRecord translationRow)
ADVANCED: This can be used to access a queries translated SQL if they have been prepared, (i.e. query.prepareCall()). |
| public AbstractRecord | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | hasSessionName()
PUBLIC: Return if a name of the session that the query should be executed under has been specified. |
| public void | ignoreBindAllParameters()
PUBLIC: Session's shouldBindAllParameters() defines whether to bind or not (default setting) |
| public void | ignoreCacheStatement()
PUBLIC: Session's shouldCacheAllStatements() defines whether to cache or not (default setting) |
| public boolean | |
| public boolean | isCascadeOfAggregateDelete()
INTERNAL: Returns true if this query has been created as the result of cascading a delete of an aggregate collection in a UnitOfWork CR 2811 |
| public Boolean | isCustomQueryUsed()
INTERNAL: PERF: Return if this query will use the descriptor custom query instead of executing itself. |
| protected boolean | isCustomSelectionQuery()
INTERNAL: If the query mechanism is a call query mechanism and there are no arguments on the query then it must be a foreign reference custom selection query. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isNativeConnectionRequired()
ADVANCED: Return if the descriptor requires usage of a native (unwrapped) JDBC connection. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | isPrepared()
INTERNAL: Queries are prepared when they are executed and then do not need to be prepared on subsequent executions. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | |
| protected void | prepare()
INTERNAL: This is different from 'prepareForExecution' in that this is called on the original query, and the other is called on the copy of the query. |
| public void | prepareCall(Session session, DataRecord translationRow)
ADVANCED: Pre-generate the call/SQL for the query. |
| protected void | prepareCustomQuery(DatabaseQuery customQuery)
INTERNAL: Set the properties needed to be cascaded into the custom query. |
| public void | |
| protected void | |
| public void | |
| public void | |
| public Object | redirectQuery(QueryRedirector redirector, DatabaseQuery queryToRedirect, AbstractSession session, AbstractRecord translationRow)
INTERNAL: Use a EclipseLink redirector to redirect this query to a method. |
| protected Object | |
| public Object | |
| public void | |
| public Map | replaceValueHoldersIn(Object object, RemoteSessionController controller)
INTERNAL: replace the value holders in the specified result object(s) |
| public void | |
| public void | |
| public AbstractRecord | rowFromArguments(List<E> argumentValues, AbstractSession session)
INTERNAL: Translate argumentValues into a database row. |
| public void | setAccessor(Accessor accessor)
INTERNAL: Set the accessor, the query must always use the same accessor for database access. |
| public void | setAccessors(Collection<Accessor> accessors)
INTERNAL: Set the list of connection accessors to execute the query on. |
| public void | setAllowNativeSQLQuery(Boolean allowNativeSQLQuery)
INTERNAL: Set to true if this individual query should be marked to bypass a persistence unit level disallow SQL queries flag. |
| public void | setArguments(List<String> arguments)
INTERNAL: Set the arguments for use with the pre-defined query option. |
| public void | setArgumentTypeNames(List<String> argumentTypeNames)
INTERNAL: Set the argumentTypes for use with the pre-defined query option |
| public void | setArgumentTypes(List<Class<?>> argumentTypes)
INTERNAL: Set the argumentTypes for use with the pre-defined query option |
| public void | setArgumentValues(List<Object> theArgumentValues)
INTERNAL: Set the argumentValues for use with argumented queries. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| protected void | |
| public void | setFlushOnExecute(Boolean flushMode)
PUBLIC: If executed against a RepeatableWriteUnitOfWork if this attribute is true EclipseLink will write changes to the database before executing the query. |
| public void | setHintString(String
the hint string to be added into the SQL call. newHintString)Used to set a database hint string on the query. |
| protected void | setIsCustomQueryUsed(final boolean
Custom query flag as isCustomQueryUsed)boolean.INTERNAL: PERF: Set if this query will use the descriptor custom query instead of executing itself. |
| public void | setIsExecutionClone(boolean isExecutionClone)
INTERNAL: PERF: Set if the query is an execution clone. |
| public void | setIsNativeConnectionRequired(boolean isNativeConnectionRequired)
ADVANCED: Set if the descriptor requires usage of a native (unwrapped) JDBC connection. |
| public void | setIsPrepared(boolean isPrepared)
INTERNAL: If changes are made to the query that affect the derived SQL or Call parameters the query needs to be prepared again. |
| public void | |
| public void | setIsUserDefinedSQLCall(boolean isUserDefinedSQLCall)
INTERNAL: Set if the query is a custom user defined sql call query. |
| public void | |
| public void | |
| public void | setNullableArguments(List<DatabaseField> nullableArguments)
INTERNAL: Set the list of arguments to check for null. |
| public void | setParameterDelimiter(String aParameterDelimiter)
INTERNAL: Set the String char used to delimit an SQL parameter. |
| public void | setPartitioningPolicy(PartitioningPolicy partitioningPolicy)
PUBLIC: Set the query's partitioning policy. |
| public void | |
| public synchronized void | setProperty(Object property, Object value)
INTERNAL: Property support used by mappings to store temporary stuff. |
| protected void | |
| public void | setQueryTimeout(int queryTimeout)
PUBLIC: Set the number of seconds the driver will wait for a Statement to execute to the given number of seconds. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setSessionName(String sessionName)
PUBLIC: Set the name of the session that the query should be executed under. |
| public void | setShouldBindAllParameters(boolean shouldBindAllParameters)
PUBLIC: Bind all arguments to any SQL statement. |
| public void | setShouldBindAllParameters(Boolean bindAllParams)
INTERNAL: Sets the internal tri-state value of shouldBindAllParams Used to cascade this value to other queries |
| public void | setShouldCacheStatement(boolean shouldCacheStatement)
PUBLIC: Cache the prepared statements, this requires full parameter binding as well. |
| public void | setShouldMaintainCache(boolean shouldMaintainCache)
PUBLIC: Set if the identity map (cache) should be used or not. |
| public void | |
| public void | setShouldRetrieveBypassCache(boolean shouldRetrieveBypassCache)
ADVANCED: JPA flag used to control the behavior of the shared cache. |
| public void | setShouldReturnGeneratedKeys(boolean shouldReturnGeneratedKeys)
ADVANCED: JPA flag used to control the behavior of IDENTITY generation. |
| public void | setShouldStoreBypassCache(boolean shouldStoreBypassCache)
ADVANCED: JPA flag used to control the behavior of the shared cache. |
| public void | setShouldUseWrapperPolicy(boolean shouldUseWrapperPolicy)
ADVANCED: The wrapper policy can be enable on a query. |
| public void | setShouldValidateUpdateCallCacheUse(boolean shouldCheckUpdateCallCacheUse)
INTERNAL: Set if additional validation should be performed before the query uses the update call cache. |
| public void | |
| public void | |
| public void | |
| public void | |
| public boolean | shouldAllowNativeSQLQuery(boolean projectAllowsNativeQueries)
INTERNAL: Return true if this individual query should allow native a SQL call to be issued. |
| public boolean | |
| public boolean | shouldCacheStatement()
PUBLIC: Cache the prepared statements, this requires full parameter binding as well. |
| public boolean | |
| public boolean | shouldCascadeByMapping()
PUBLIC: Mappings should be checked to determined if the current operation should be cascaded to the objects referenced. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | shouldIgnoreBindAllParameters()
PUBLIC: Local shouldBindAllParameters() should be ignored, Session's shouldBindAllParameters() should be used. |
| public boolean | shouldIgnoreCacheStatement()
PUBLIC: Local shouldCacheStatement() should be ignored, Session's shouldCacheAllStatements() should be used. |
| public boolean | |
| public boolean | |
| public boolean | shouldPrepare(AbstractRecord translationRow, AbstractSession session)
INTERNAL: Check if the query should be prepared, or dynamic, depending on the arguments. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | shouldValidateUpdateCallCacheUse()
ADVANCED: Return true if additional validation should be performed before the query uses the update call cache, false otherwise. |
| public void | |
| public String |