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

public Class DescriptorQueryManager

extends Object
implements Cloneable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, java.lang.Cloneable
Imports
java.io.Serializable, java.util.ArrayList, .Enumeration, .HashMap, .Iterator, .LinkedHashMap, .List, .Map, .Vector, java.util.concurrent.TimeUnit, org.eclipse.persistence.exceptions.ConversionException, .DescriptorException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.internal.databaseaccess.DatasourceCall, org.eclipse.persistence.internal.descriptors.ObjectBuilder, org.eclipse.persistence.internal.expressions.CompoundExpression, .FunctionExpression, .ParameterExpression, .SubSelectExpression, org.eclipse.persistence.internal.helper.ConcurrentFixedCache, .DatabaseTable, .Helper, .NonSynchronizedVector, org.eclipse.persistence.internal.queries.ReportItem, org.eclipse.persistence.internal.sessions.AbstractSession, .ChangeRecord, .ObjectChangeSet, org.eclipse.persistence.mappings.DatabaseMapping, org.eclipse.persistence.queries.Call, .DatabaseQuery, .DeleteObjectQuery, .DoesExistQuery, .InsertObjectQuery, .JPAQueryBuilder, .ObjectLevelReadQuery, .QueryResultsCachePolicy, .ReadAllQuery, .ReadObjectQuery, .ReadQuery, .ReportQuery, .UpdateObjectQuery, .WriteObjectQuery

Purpose: The query manager allows for the database operations that EclipseLink performs to be customized by the application. For each descriptor a query can be given that controls how a operation will occur. A common example is if the application requires a stored procedure to be used to insert the object, it can override the SQL call in the insert query that EclipseLink will use to insert the object. Queries can be customized to extend EclipseLink behavior, access non-relational data or use stored procedures or customized SQL calls.

The queries that can be customized include:

See Also
ClassDescriptor

Field Summary

Modifier and TypeField and Description
protected String
protected transient Expression
protected transient ConcurrentFixedCache
cachedExpressionQueries

PERF: Expression query call cache for avoiding regenerated dynamic query SQL.

protected transient ConcurrentFixedCache
cachedUpdateCalls

PERF: Update call cache for avoiding regenerated update SQL.

public static final int
public static final TimeUnit
protected DeleteObjectQuery
protected ClassDescriptor
protected DoesExistQuery
protected boolean
protected InsertObjectQuery
protected transient Expression
public static final int
NoTimeout

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 Map<String, List<DatabaseQuery>>
protected int
protected TimeUnit
protected ReadAllQuery
protected ReadObjectQuery
protected transient Map<DatabaseTable, Expression>
protected UpdateObjectQuery

Constructor Summary

AccessConstructor and Description
public
DescriptorQueryManager()

INTERNAL: Initialize the state of the descriptor query manager

Method Summary

Modifier and TypeMethod and Description
public void
addQuery(String
This is the name of the query. It will be set on the query and used to look it up.
name
,
DatabaseQuery
This is the query that will be added. If the query being added has parameters, the existing list of queries will be checked for matching queries. If a matching query exists, it will be replaced.
query
)

PUBLIC: Add the query to the descriptor queries with the given name

public synchronized void
addQuery(DatabaseQuery
DatabaseQuery This is the query that will be added. If the query being added has parameters, the existing list of queries will be checked for matching queries. If a matching query exists, it will be replaced.
query
)

PUBLIC: Add the query to the session queries

public void
assumeExistenceForDoesExist()

PUBLIC: Assume that if the objects primary key does not include null then it must exist.

public void
assumeNonExistenceForDoesExist()

PUBLIC: Assume that the object does not exist.

public void
checkCacheForDoesExist()

PUBLIC: Default behavior.

public void
checkDatabaseForDoesExist()

PUBLIC: Perform does exist check on the database

public Object
clone()

Overrides java.lang.Object.clone.

INTERNAL: Clone the query manager
public boolean
containsQuery(String queryName)

PUBLIC: Return true if the query is defined on the session

public void
convertClassNamesToClasses(ClassLoader classLoader)

INTERNAL: Convert all the class-name-based settings in this Query Manager to actual class-based settings This method is implemented by subclasses as necessary.

public Expression
getAdditionalJoinExpression()

ADVANCED: Returns the join expression that should be appended to all of the descriptors expressions Contains any multiple table or inheritance dependencies

public Vector<E>
getAllQueries()

PUBLIC: Return the pre-defined queries for the descriptor.

private ConcurrentFixedCache
getCachedExpressionQueries()

INTERNAL: Returns the collection of cached expression queries.

public DatabaseQuery
getCachedExpressionQuery(DatabaseQuery query)

INTERNAL: Return the cached SQL call for the expression query.

private ConcurrentFixedCache
getCachedUpdateCalls()

INTERNAL: Returns the collection of cached Update calls.

public Vector<E>
getCachedUpdateCalls(Vector<E> updateFields)

INTERNAL: Return the cached update SQL call based on the updated fields.

public Call
getDeleteCall()

ADVANCED: Return the receiver's delete call.

public DeleteObjectQuery
getDeleteQuery()

ADVANCED: Return the receiver's delete query.

public String
getDeleteSQLString()

ADVANCED: Return the receiver's delete SQL string.

public ClassDescriptor
getDescriptor()

INTERNAL: Return the descriptor associated with this descriptor query manager

public Call
getDoesExistCall()

ADVANCED: Return the receiver's does-exist call.

public DoesExistQuery
getDoesExistQuery()

ADVANCED: Return the receiver's does exist query.

public String
getDoesExistSQLString()

ADVANCED: Return the receiver's does exist SQL string.

public String
getExistenceCheck()

INTERNAL: This method is explicitly used by the Builder only.

public int
getExpressionQueryCacheMaxSize()

ADVANCED: Return the max size of the expression query cache for avoiding regenerated dynamic query SQL.

public Call
getInsertCall()

ADVANCED: Return the receiver's insert call.

public InsertObjectQuery
getInsertQuery()

ADVANCED: Return the receiver's insert query.

public String
getInsertSQLString()

ADVANCED: Return the receiver's insert SQL string.

public DatabaseQuery
getLocalQuery(String name, Vector<E> arguments)

INTENAL: Return the query from the set of pre-defined queries with the given name and argument types.

public DatabaseQuery
getLocalQueryByArgumentTypes(String name, List<E> argumentTypes)

INTERNAL: Return the query from the set of pre-defined queries with the given name and argument types.

public Expression
getMultipleTableJoinExpression()

ADVANCED: This is normally generated for descriptors that have multiple tables.

public DescriptorQueryManager
getParentDescriptorQueryManager()

INTERNAL: Get the parent DescriptorQueryManager.

public Map<String, List<DatabaseQuery>>
getQueries()

PUBLIC: Return the pre-defined queries for the descriptor.

public DatabaseQuery
getQuery(String queryName)

PUBLIC: Return the query name from the set of pre-defined queries If only one query exists with this name, it will be returned.

public DatabaseQuery
getQuery(String name, Vector<E> arguments)

PUBLIC: Return the query from the set of pre-defined queries with the given name and argument types.

protected DatabaseQuery
getQueryFromParent(String name, Vector<E> arguments)

INTERNAL: CR#3711: Check if the class for this descriptor has a parent class.

public int
getQueryTimeout()

PUBLIC: Return the number of seconds queries will wait for their Statement to execute.

public TimeUnit
public Call
getReadAllCall()

ADVANCED: Return the receiver's read-all call.

public ReadAllQuery
getReadAllQuery()

ADVANCED: Return the receiver's read query.

public String
getReadAllSQLString()

ADVANCED: Return the receiver's read SQL string.

public Call
getReadObjectCall()

ADVANCED: Return the receiver's read-object call.

public ReadObjectQuery
getReadObjectQuery()

ADVANCED: Return the receiver's read query.

public String
getReadObjectSQLString()

ADVANCED: Return the receiver's read SQL string.

public Map<DatabaseTable, Expression>
getTablesJoinExpressions()

INTERNAL: Used in case descriptor has additional tables: each additional table mapped to an expression joining it.

public Call
getUpdateCall()

ADVANCED: Return the receiver's update call.

public int
getUpdateCallCacheSize()

ADVANCED: Return the size of the update call cache.

public UpdateObjectQuery
getUpdateQuery()

ADVANCED: Return the receiver's update query.

public String
getUpdateSQLString()

ADVANCED: Return the receiver's update SQL string.

public boolean
hasAdditionalCriteria()

ADVANCED: Return true if an additional criteria has been set on this query manager.

public boolean
hasCustomMultipleTableJoinExpression()

INTERNAL: Return if a custom join expression is used.

public boolean
hasDeleteQuery()

INTERNAL: Flag that specifies if a delete query is available

public boolean
hasDoesExistQuery()

INTERNAL: Flag that specifies if a does exist query is available

public boolean
hasInsertQuery()

INTERNAL: Flag that specifies if a insert query is available

public boolean
hasReadAllQuery()

INTERNAL: Flag that specifies if a read all query is available

public boolean
hasReadObjectQuery()

INTERNAL: Flag that specifies if a read object query is available

public boolean
hasUpdateQuery()

INTERNAL: Flag that specifies if a update query is available

public void
initialize(AbstractSession session)

INTERNAL: Post initialize the mappings

public void
initializeQueryTimeout(AbstractSession session)

INTERNAL: Initialize the queryTimeout to: NoTimeout: If queryTimeout is DefaultTimeout, either directly or via inheritance.

private void
populateQueries()

INTERNAL: populate the queries with the descriptor.

public void
postDelete(DeleteObjectQuery query)

INTERNAL: Execute the post delete operation for the query

public void
postInitialize(AbstractSession session)

INTERNAL: Post initializations after mappings are initialized.

public void
postInsert(WriteObjectQuery query)

INTERNAL: Execute the post insert operation for the query

public void
postUpdate(WriteObjectQuery query)

INTERNAL: Execute the post update operation for the query

public void
preDelete(DeleteObjectQuery query)

INTERNAL: Execute the pre delete operation for the query

public void
preInitialize(AbstractSession session)

INTERNAL: Initialize the query manager.

public void
preInsert(WriteObjectQuery query)

INTERNAL: Execute the pre insert operation for the query.

public void
preUpdate(WriteObjectQuery query)

INTERNAL: Execute the pre update operation for the query

public void
putCachedExpressionQuery(DatabaseQuery query)

INTERNAL: Set the cached SQL call for the expression query.

public void
putCachedUpdateCalls(Vector<E> updateFields, Vector<E> updateCalls)

INTERNAL: Cache a clone of the update SQL calls based on the updated fields.

public void
removeCachedExpressionQuery(DatabaseQuery query)

INTERNAL: Remove the cached expression query.

public void
removeQuery(String queryName)

PUBLIC: Remove all queries with the given query name from the set of pre-defined queries

public void
removeQuery(String queryName, Vector<E> argumentTypes)

PUBLIC: Remove the specific query with the given queryName and argumentTypes.

public void
setAdditionalCriteria(String additionalCriteria)

ADVANCED: Set the additional join criteria that will be used to form the additional join expression.

public void
setAdditionalJoinExpression(Expression additionalJoinExpression)

ADVANCED: Set the additional join expression.

public void
setAllQueries(Vector<E> vector)

INTERNAL: Set pre-defined queries for the descriptor.

public void
setDeleteCall(Call call)

ADVANCED: Set the receiver's delete call.

public void
setDeleteQuery(DeleteObjectQuery query)

ADVANCED: Set the receiver's delete query.

public void
setDeleteSQLString(String sqlString)

ADVANCED: Set the receiver's delete SQL string.

public void
setDescriptor(ClassDescriptor descriptor)

INTERNAL: Set the descriptor.

public void
setDoesExistCall(Call call)

ADVANCED: Set the receiver's does exist call.

public void
setDoesExistQuery(DoesExistQuery query)

ADVANCED: Set the receiver's does exist query.

public void
setDoesExistSQLString(String sqlString)

ADVANCED: Set the receiver's does exist SQL string.

public void
setExistenceCheck(String token)

INTERNAL: This method is explicitly used by the Builder only.

public void
setExpressionQueryCacheMaxSize(int maxSize)

ADVANCED: Set the max size of the expression query cache for avoiding regenerated dynamic query SQL.

protected void
setHasCustomMultipleTableJoinExpression(boolean hasCustomMultipleTableJoinExpression)

INTENAL: Set if a custom join expression is used.

public void
setInsertCall(Call call)

ADVANCED: Set the receiver's insert call.

public void
setInsertQuery(InsertObjectQuery insertQuery)

ADVANCED: Set the receiver's insert query.

public void
setInsertSQLString(String sqlString)

ADVANCED: Set the receiver's insert SQL string.

public void
setInternalMultipleTableJoinExpression(Expression multipleTableJoinExpression)

INTERNAL: Used to set the multiple table join expression that was generated by EclipseLink as opposed to a custom one supplied by the user.

public void
setMultipleTableJoinExpression(Expression multipleTableJoinExpression)

ADVANCED: This is normally generated for descriptors that have multiple tables.

public void
setQueries(Map<K, V> map)

PUBLIC: set the pre-defined queries for the descriptor.

public void
setQueryTimeout(int queryTimeout)

PUBLIC: Set the number of seconds that queries will wait for their Statement to execute.

public void
setQueryTimeoutUnit(TimeUnit queryTimeoutUnit)

public void
setReadAllCall(Call call)

ADVANCED: Set the receiver's read all call.

public void
setReadAllQuery(ReadAllQuery query)

ADVANCED: Set the receiver's read all query.

public void
setReadAllSQLString(String sqlString)

ADVANCED: Set the receiver's read SQL string.

public void
setReadObjectCall(Call call)

ADVANCED: Set the receiver's read object call.

public void
setReadObjectQuery(ReadObjectQuery query)

ADVANCED: Set the receiver's read query.

public void
setReadObjectSQLString(String sqlString)

ADVANCED: Set the receiver's read SQL string.

public void
setUpdateCall(Call call)

ADVANCED: Set the receiver's update call.

public void
setUpdateCallCacheSize(int updateCallCacheSize)

ADVANCED: Set the size of the update call cache.

public void
setUpdateQuery(UpdateObjectQuery updateQuery)

ADVANCED: Set the receiver's update query.

public void
setUpdateSQLString(String sqlString)

ADVANCED: Set the receiver's update SQL string.

protected void
updatePropertyParameterExpression(Expression exp)

INTERNAL: This method will walk the given expression and mark any parameter expressions as property expressions.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait