Oracle Application Server TopLink API Reference
10g (9.0.4.3)

B10491-02

oracle.toplink.queryframework
Class DatabaseQuery

java.lang.Object
  extended byoracle.toplink.queryframework.DatabaseQuery

All Implemented Interfaces:
java.lang.Cloneable, oracle.toplink.internal.helper.FalseUndefinedTrue, java.io.Serializable
Direct Known Subclasses:
DoesExistQuery, ModifyQuery, ReadQuery

public abstract class DatabaseQuery
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, oracle.toplink.internal.helper.FalseUndefinedTrue

Purpose: Abstract class for all database query objects. DatabaseQuery is a visible class to the TopLink user. Users create an appropriate query by creating an instance of a concrete subclasses of DatabaseQuery.

Responsibilities:

Since:
TOPLink/Java 1.0
See Also:
Serialized Form

Field Summary
static int CascadeAggregateDelete
           
static int CascadeAllParts
           
static int CascadeDependentParts
           
static int CascadePrivateParts
           
static int NoCascading
           
static java.lang.String QUERY_PREPARE
           

 

Fields inherited from interface oracle.toplink.internal.helper.FalseUndefinedTrue
False, True, Undefined

 

Constructor Summary
DatabaseQuery()
          PUBLIC: Initialize the state of the query

 

Method Summary
 void addArgument(java.lang.String argumentName)
          PUBLIC: Add the argument named argumentName.
 void addArgument(java.lang.String argumentName, java.lang.Class type)
          PUBLIC: Add the argument named argumentName and its class type.
 void addArgument(java.lang.String argumentName, java.lang.String typeAsString)
          PUBLIC: Add the argument named argumentName and its class type.
 void addArgumentValue(java.lang.String argumentValue)
          PUBLIC: Add the argumentValue named argumentName.
 void addArgumentValues(java.util.Vector theArgumentValues)
          PUBLIC: Add the argumentValues to the query
 void addCall(Call call)
          PUBLIC: Used to define a store procedure or SQL query.
 void addStatement(oracle.toplink.internal.expressions.SQLStatement statement)
          PUBLIC: Used to define a statement level query.
 void bindAllParameters()
          PUBLIC: Bind all arguments to any SQL statement.
 void cacheStatement()
          PUBLIC: Cache the prepared statements, this requires full parameter binding as well.
 void cascadeAllParts()
          PUBLIC: Cascade the query and its properties on the queries object(s) and all objects related to the queries object(s).
 void cascadeOnlyDependentParts()
          INTERNAL: Used by unit of work, only cascades constraint dependecies.
 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).
 java.lang.Object checkEarlyReturn(oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          INTERNAL: Check to see if this query already knows the return vale without preforming any further work.
 void checkPrepare(oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          INTERNAL: Check to see if this query needs to be prepare and prepare it.
 java.lang.Object clone()
          INTERNAL: Clone the query
 void dontBindAllParameters()
          PUBLIC: Do not Bind all arguments to any SQL statement.
 void dontCacheStatement()
          PUBLIC: Dont cache the prepared statements, this requires full parameter binding as well.
 void dontCascadeParts()
          PUBLIC: Do not cascade the query and its properties on the queries object(s) relationships.
 void dontMaintainCache()
          PUBLIC: Set for the identity map (cache) to be ignored completely.
abstract  java.lang.Object execute()
          INTERNAL: Execute the query
 java.lang.Object execute(oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          INTERNAL: Execute the query.
 java.lang.Object extractRemoteResult(oracle.toplink.internal.remote.Transporter transporter)
          INTERNAL: Extract the correct query result from the transporter.
 oracle.toplink.internal.databaseaccess.Accessor getAccessor()
          INTERNAL: Return the accessor.
 java.util.Vector getArguments()
          INTERNAL: Return the arguments for use with the pre-defined query option
 java.util.Vector getArgumentTypes()
          INTERNAL: Return the argumentTypes for use with the pre-defined query option
 java.util.Vector getArgumentValues()
          INTERNAL: Return the argumentValues for use with the pre-defined query option
 oracle.toplink.internal.databaseaccess.DatabaseCall getCall()
          ADVANCED: Return the call for this query.
 int getCascadePolicy()
          INTERNAL: Return the cascade policy.
 Descriptor getDescriptor()
          INTERNAL: Return the descriptor assigned with the reference class
 java.lang.String getEJBQLString()
          PUBLIC: Return the SQL string of the query.
 java.lang.String getHintString()
          PUBLIC: Return the current Oracle Hint string of the query
 java.lang.String getName()
          PUBLIC: Return the name of the query
 java.util.Hashtable getProperties()
          INTERNAL: Property support for use by mappings.
 java.lang.Object getProperty(java.lang.Object property)
          INTERNAL: Property support used by mappings to stach temporary stuff in the query.
 oracle.toplink.internal.queryframework.DatabaseQueryMechanism getQueryMechanism()
          INTERNAL: Return the mechanism assigned to the query
 int getQueryTimeout()
          PUBLIC: Return the number of seconds the driver will wait for a Statement to execute to the given number of seconds.
 QueryRedirector getRedirector()
          PUBLIC: Return the query redirector.
 java.lang.Class getReferenceClass()
          PUBLIC: Return the domain class associated with this query.
 Expression getSelectionCriteria()
          PUBLIC: Return the selection criteria of the query.
 oracle.toplink.publicinterface.Session getSession()
          INTERNAL: Return the current session.
 java.lang.String getSessionName()
          PUBLIC: Return the name of the session that the query should be executed under.
 oracle.toplink.internal.expressions.SQLStatement getSQLStatement()
          PUBLIC: Return the SQL statement of the query.
 java.lang.String getSQLString()
          PUBLIC: Return the SQL string of the query.
 java.lang.String getTranslatedSQLString(oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          ADVANCED: This can be used to access a queries translated SQL if they have been prepared, (i.e. query.prepareCall()).
 DatabaseRow getTranslationRow()
          INTERNAL: Return the row for translation
 boolean hasAccessor()
          INTERNAL: returns true if the accessor has already been set.
 boolean hasProperties()
          INTERNAL: Return if any properties exist in the query.
 boolean hasSessionName()
          PUBLIC: Return if a name of the session that the query should be executed under has been specified.
 void ignoreBindAllParameters()
          PUBLIC: Session's shouldBindAllParameters() defines whether to bind or not (default setting)
 void ignoreCacheStatement()
          PUBLIC: Session's shouldCacheAllStatements() defines whether to cache or not (default setting)
 boolean isCallQuery()
          PUBLIC: Return true if this query uses an SQL, stored procedure, or SDK call.
 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
 boolean isDataModifyQuery()
          PUBLIC: Return if this is a data modify query.
 boolean isDataReadQuery()
          PUBLIC: Return if this is a data read query.
 boolean isDeleteObjectQuery()
          PUBLIC: Return if this is a delete object query.
 boolean isExpressionQuery()
          PUBLIC: Return true if this query uses an expression query mechanism
 boolean isModifyQuery()
          PUBLIC: Return if this is a modify query.
 boolean isObjectLevelModifyQuery()
          PUBLIC: Return if this is an object level modify query.
 boolean isObjectLevelReadQuery()
          PUBLIC: Return if this is an object level read query.
 boolean isReadAllQuery()
          PUBLIC: Return if this is a read all query.
 boolean isReadObjectQuery()
          PUBLIC: Return if this is a read object query.
 boolean isReadQuery()
          PUBLIC: Return if this is a read query.
 boolean isReportQuery()
          PUBLIC: Return if this is a report query.
 boolean isSQLCallQuery()
          PUBLIC: Return true if this query uses an SQL query mechanism .
 boolean isUserDefined()
          INTERNAL: Return true if the query is a custom user defined query.
 boolean isWriteObjectQuery()
          PUBLIC: Return if this is a write object query.
 void maintainCache()
          PUBLIC: Set for the identity map (cache) to be maintained.
 void prepareCall(oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          ADVANCED: Pre-generate the call/SQL for the query.
 void prepareForExecution()
          INTERNAL: Prepare the receiver for execution in a session.
 java.lang.Object redirectQuery(DatabaseQuery queryToRedirect, oracle.toplink.publicinterface.Session session, DatabaseRow translationRow)
          INTERNAL: Use a TopLink redirector to redirect this query to a method.
 java.lang.Object remoteExecute(oracle.toplink.publicinterface.Session session)
          INTERNAL:
 void removeProperty(java.lang.Object property)
          INTERNAL: Property support used by mappings.
 oracle.toplink.internal.helper.IdentityHashtable replaceValueHoldersIn(java.lang.Object object, oracle.toplink.internal.remote.RemoteSessionController controller)
          INTERNAL: replace the value holders in the specified result object(s)
 DatabaseRow rowFromArguments(java.util.Vector argumentValues)
          INTERNAL: Translate argumentValues into a database row.
 void setAccessor(oracle.toplink.internal.databaseaccess.Accessor accessor)
          INTERNAL: Set the accessor, the query must always use the same accessor for database access.
 void setArguments(java.util.Vector arguments)
          INTERNAL: Set the arguments for use with the pre-defined query option.
 void setArgumentTypes(java.util.Vector argumentTypes)
          INTERNAL: Set the argumentTypes for use with the pre-defined query option
 void setArgumentValues(java.util.Vector theArgumentValues)
          INTERNAL: Return the argumentValues for use with the pre-defined query option
 void setCall(Call call)
          PUBLIC: Used to define a store procedure or SQL query.
 void setCascadePolicy(int policyConstant)
          INTERNAL: Set the cascade policy.
 void setDescriptor(Descriptor descriptor)
          INTERNAL: Set the descriptor for the query.
 void setEJBQLString(java.lang.String ejbqlString)
          PUBLIC: To any user of this object.
 void setHintString(java.lang.String newHintString)
          PUBLIC: Used to set the Oracle Hint string on the query.
 void setIsUserDefined(boolean isUserDefined)
          INTERNAL: Set if the query is a custom user defined query.
 void setName(java.lang.String queryName)
          PUBLIC: Set the query's name.
 void setProperties(java.util.Hashtable properties)
          INTERNAL: Property support used by mappings.
 void setProperty(java.lang.Object property, java.lang.Object value)
          INTERNAL: Property support used by mappings to stache temporary stuff.
 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.
 void setRedirector(QueryRedirector redirector)
          PUBLIC: Set the query redirector.
 void setSelectionCriteria(Expression expression)
          PUBLIC: To any user of this object.
 void setSession(oracle.toplink.publicinterface.Session session)
          INTERNAL: Set the session for the query
 void setSessionName(java.lang.String sessionName)
          PUBLIC: Set the name of the session that the query should be executed under.
 void setShouldBindAllParameters(boolean shouldBindAllParameters)
          PUBLIC: Bind all arguments to any SQL statement.
 void setShouldCacheStatement(boolean shouldCacheStatement)
          PUBLIC: Cache the prepared statements, this requires full parameter binding as well.
 void setShouldMaintainCache(boolean shouldMaintainCache)
          PUBLIC: Set if the identity map (cache) should be used or not.
 void setShouldPrepare(boolean shouldPrepare)
          PUBLIC: Set if the query should be prepared.
 void setShouldUseWrapperPolicy(boolean shouldUseWrapperPolicy)
          ADVANCED: The wrapper policy can be enable on a query.
 void setSQLStatement(oracle.toplink.internal.expressions.SQLStatement sqlStatement)
          PUBLIC: To any user of this object.
 void setSQLString(java.lang.String sqlString)
          PUBLIC: To any user of this object.
 void setTranslationRow(DatabaseRow translationRow)
          INTERNAL: Set the row for translation
 boolean shouldBindAllParameters()
          PUBLIC: Bind all arguments to any SQL statement.
 boolean shouldCacheStatement()
          PUBLIC: Cache the prepared statements, this requires full parameter binding as well.
 boolean shouldCascadeAllParts()
          PUBLIC: Flag used to determine if all parts should be cascaded
 boolean shouldCascadeOnlyDependentParts()
          INTERNAL: Flag used for unit of works cascade policy.
 boolean shouldCascadeParts()
          PUBLIC: Flag used to determine if any parts should be cascaded
 boolean shouldCascadePrivateParts()
          PUBLIC: Flag used to determine if any private parts should be cascaded
 boolean shouldIgnoreBindAllParameters()
          PUBLIC: Local shouldBindAllParameters() should be ignored, Session's shouldBindAllParameters() should be used.
 boolean shouldIgnoreCacheStatement()
          PUBLIC: Local shouldCacheStatement() should be ignored, Session's shouldCacheAllStatements() should be used.
 boolean shouldIgnoreMaintainCache()
          INTERNAL: Local shouldMaintainCache() should be ignored, Descriptor's shouldDisableCacheHits() should be used.
 boolean shouldMaintainCache()
          PUBLIC: Return if the identity map (cache) should be used or not.
 boolean shouldPrepare()
          PUBLIC: Return if the query should be prepared.
 boolean shouldUseWrapperPolicy()
          ADVANCED: The wrapper policy can be enabled on a query.
 java.lang.String toString()
           

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Field Detail

QUERY_PREPARE

public static final java.lang.String QUERY_PREPARE
See Also:
Constant Field Values

NoCascading

public static final int NoCascading
See Also:
Constant Field Values

CascadePrivateParts

public static final int CascadePrivateParts
See Also:
Constant Field Values

CascadeAllParts

public static final int CascadeAllParts
See Also:
Constant Field Values

CascadeDependentParts

public static final int CascadeDependentParts
See Also:
Constant Field Values

CascadeAggregateDelete

public static final int CascadeAggregateDelete
See Also:
Constant Field Values
Constructor Detail

DatabaseQuery

public DatabaseQuery()
PUBLIC: Initialize the state of the query
Method Detail

addArgument

public void addArgument(java.lang.String argumentName)
PUBLIC: Add the argument named argumentName. This will cause the translation of references of argumentName in the receiver's expression, with the value of the argument as supplied to the query in order from executeQuery()

addArgument

public void addArgument(java.lang.String argumentName,
                        java.lang.Class type)
PUBLIC: Add the argument named argumentName and its class type. This will cause the translation of references of argumentName in the receiver's expression, with the value of the argument as supplied to the query in order from executeQuery(). Specifying the class type is important if identically named queries are used but with different argument lists.

addArgument

public void addArgument(java.lang.String argumentName,
                        java.lang.String typeAsString)
PUBLIC: Add the argument named argumentName and its class type. This will cause the translation of references of argumentName in the receiver's expression, with the value of the argument as supplied to the query in order from executeQuery(). Specifying the class type is important if identically named queries are used but with different argument lists.

addArgumentValue

public void addArgumentValue(java.lang.String argumentValue)
PUBLIC: Add the argumentValue named argumentName. This will cause the translation of references of argumentValues in the receiver's expression, with the value of the argument as supplied to the query in order from executeQuery()

addArgumentValues

public void addArgumentValues(java.util.Vector theArgumentValues)
PUBLIC: Add the argumentValues to the query

addCall

public void addCall(Call call)
PUBLIC: Used to define a store procedure or SQL query. This may be used for multiple SQL executions to be mapped to a single query. This cannot be used for cursored selects, delete alls or does exists.

addStatement

public void addStatement(oracle.toplink.internal.expressions.SQLStatement statement)
PUBLIC: Used to define a statement level query. This may be used for multiple SQL executions to be mapped to a single query. This cannot be used for cursored selects, delete alls or does exists.

bindAllParameters

public void bindAllParameters()
PUBLIC: Bind all arguments to any SQL statement.

cacheStatement

public void cacheStatement()
PUBLIC: Cache the prepared statements, this requires full parameter binding as well.

cascadeAllParts

public void cascadeAllParts()
PUBLIC: Cascade the query and its properties on the queries object(s) and all objects related to the queries object(s). This includes private and independent relationships, but not read-only relationships. This will still stop on uninstantiated indirection objects except for deletion. Great caution should be used in using the property as the query may effect a large number of objects. This policy is used by the unit of work to ensure persistence by reachability.

cascadeOnlyDependentParts

public void cascadeOnlyDependentParts()
INTERNAL: Used by unit of work, only cascades constraint dependecies.

cascadePrivateParts

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). This is the default for write and delete queries. This policy should normally be used for refreshing, otherwise you could refresh half of any object.

checkEarlyReturn

public java.lang.Object checkEarlyReturn(oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
INTERNAL: Check to see if this query already knows the return vale without preforming any further work.

checkPrepare

public void checkPrepare(oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
INTERNAL: Check to see if this query needs to be prepare and prepare it. The prepare is done on the original query to ensure that the work is not repeated.

clone

public java.lang.Object clone()
INTERNAL: Clone the query

dontBindAllParameters

public void dontBindAllParameters()
PUBLIC: Do not Bind all arguments to any SQL statement.

dontCacheStatement

public void dontCacheStatement()
PUBLIC: Dont cache the prepared statements, this requires full parameter binding as well.

dontCascadeParts

public void dontCascadeParts()
PUBLIC: Do not cascade the query and its properties on the queries object(s) relationships. This does not effect the queries private parts but only the object(s) direct row-level attributes. This is the default for read queries and can be used in writting if it is known that only row-level attributes changed, or to resolve circular foreign key dependencies.

dontMaintainCache

public void dontMaintainCache()
PUBLIC: Set for the identity map (cache) to be ignored completely. The cache check will be skipped and the result will not be put into the identity map. This can be used to retreive the exact state of an object on the database. By default the identity map is always maintained.

execute

public abstract java.lang.Object execute()
                                  throws DatabaseException,
OptimisticLockException
INTERNAL: Execute the query
Returns:
- the result of executing the query.
Throws:
DatabaseException - - an error has occurred on the database.
OptimisticLockException - - an error has occurred using the optimistic lock feature.

execute

public java.lang.Object execute(oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
                         throws DatabaseException,
OptimisticLockException
INTERNAL: Execute the query. If there are objects in the cache return the results of the cache lookup.
Parameters:
session - - the session in which the receiver will be executed.
Returns:
An object, the result of executing the query.
Throws:
DatabaseException - - an error has occurred on the database.
OptimisticLockException - - an error has occurred using the optimistic lock feature.

extractRemoteResult

public java.lang.Object extractRemoteResult(oracle.toplink.internal.remote.Transporter transporter)
INTERNAL: Extract the correct query result from the transporter.

getAccessor

public oracle.toplink.internal.databaseaccess.Accessor getAccessor()
INTERNAL: Return the accessor.

getArguments

public java.util.Vector getArguments()
INTERNAL: Return the arguments for use with the pre-defined query option

getArgumentTypes

public java.util.Vector getArgumentTypes()
INTERNAL: Return the argumentTypes for use with the pre-defined query option

setArgumentTypes

public void setArgumentTypes(java.util.Vector argumentTypes)
INTERNAL: Set the argumentTypes for use with the pre-defined query option

setArguments

public void setArguments(java.util.Vector arguments)
INTERNAL: Set the arguments for use with the pre-defined query option. Maintain the argumentTypes as well.

getArgumentValues

public java.util.Vector getArgumentValues()
INTERNAL: Return the argumentValues for use with the pre-defined query option

setArgumentValues

public void setArgumentValues(java.util.Vector theArgumentValues)
INTERNAL: Return the argumentValues for use with the pre-defined query option

getCall

public oracle.toplink.internal.databaseaccess.DatabaseCall getCall()
ADVANCED: Return the call for this query. This call contains the SQL and argument list.
See Also:
prepareCall(Session, DatabaseRow);

getCascadePolicy

public int getCascadePolicy()
INTERNAL: Return the cascade policy.

getDescriptor

public Descriptor getDescriptor()
INTERNAL: Return the descriptor assigned with the reference class

getName

public java.lang.String getName()
PUBLIC: Return the name of the query

getProperties

public java.util.Hashtable getProperties()
INTERNAL: Property support for use by mappings.

getProperty

public java.lang.Object getProperty(java.lang.Object property)
INTERNAL: Property support used by mappings to stach temporary stuff in the query.

getQueryMechanism

public oracle.toplink.internal.queryframework.DatabaseQueryMechanism getQueryMechanism()
INTERNAL: Return the mechanism assigned to the query

getQueryTimeout

public int getQueryTimeout()
PUBLIC: Return the number of seconds the driver will wait for a Statement to execute to the given number of seconds.

getRedirector

public QueryRedirector getRedirector()
PUBLIC: Return the query redirector. A redirector can be used in a query to replace its execution with the execution of code. This can be used for named or parameterized queries to allow dynamic configuration of the query base on the query arguments.
See Also:
QueryRedirector

getReferenceClass

public java.lang.Class getReferenceClass()
PUBLIC: Return the domain class associated with this query. By default this is null, but should be overridden in subclasses.

getSelectionCriteria

public Expression getSelectionCriteria()
PUBLIC: Return the selection criteria of the query. This should only be used with expression queries, null will be returned for others.

getSession

public oracle.toplink.publicinterface.Session getSession()
INTERNAL: Return the current session.

getSessionName

public java.lang.String getSessionName()
PUBLIC: Return the name of the session that the query should be executed under. This can be with the session broker to override the default session.

getSQLStatement

public oracle.toplink.internal.expressions.SQLStatement getSQLStatement()
PUBLIC: Return the SQL statement of the query. This can only be used with statement queries.

getEJBQLString

public java.lang.String getEJBQLString()
PUBLIC: Return the SQL string of the query. This can be used for SQL queries. ADVANCED: This can also be used for normal queries if they have been prepared, (i.e. query.prepareCall()).
See Also:
prepareCall(Session, DatabaseRow)

getHintString

public java.lang.String getHintString()
PUBLIC: Return the current Oracle Hint string of the query
Returns:
String - The hint string for this query

getSQLString

public java.lang.String getSQLString()
PUBLIC: Return the SQL string of the query. This can be used for SQL queries. ADVANCED: This can also be used for normal queries if they have been prepared, (i.e. query.prepareCall()).
See Also:
prepareCall(Session, DatabaseRow)

getTranslatedSQLString

public java.lang.String getTranslatedSQLString(oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
ADVANCED: This can be used to access a queries translated SQL if they have been prepared, (i.e. query.prepareCall()).
See Also:
prepareCall(Session, DatabaseRow)

getTranslationRow

public DatabaseRow getTranslationRow()
INTERNAL: Return the row for translation

hasAccessor

public boolean hasAccessor()
INTERNAL: returns true if the accessor has already been set. The getAccessor() will attempt to lazily initialzie it.

hasProperties

public boolean hasProperties()
INTERNAL: Return if any properties exist in the query.

hasSessionName

public boolean hasSessionName()
PUBLIC: Return if a name of the session that the query should be executed under has been specified. This can be with the session broker to override the default session.

ignoreBindAllParameters

public void ignoreBindAllParameters()
PUBLIC: Session's shouldBindAllParameters() defines whether to bind or not (default setting)

ignoreCacheStatement

public void ignoreCacheStatement()
PUBLIC: Session's shouldCacheAllStatements() defines whether to cache or not (default setting)

isCallQuery

public boolean isCallQuery()
PUBLIC: Return true if this query uses an SQL, stored procedure, or SDK call.

isCascadeOfAggregateDelete

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

isDataModifyQuery

public boolean isDataModifyQuery()
PUBLIC: Return if this is a data modify query.

isDataReadQuery

public boolean isDataReadQuery()
PUBLIC: Return if this is a data read query.

isDeleteObjectQuery

public boolean isDeleteObjectQuery()
PUBLIC: Return if this is a delete object query.

isExpressionQuery

public boolean isExpressionQuery()
PUBLIC: Return true if this query uses an expression query mechanism

isModifyQuery

public boolean isModifyQuery()
PUBLIC: Return if this is a modify query.

isObjectLevelModifyQuery

public boolean isObjectLevelModifyQuery()
PUBLIC: Return if this is an object level modify query.

isObjectLevelReadQuery

public boolean isObjectLevelReadQuery()
PUBLIC: Return if this is an object level read query.

isReadAllQuery

public boolean isReadAllQuery()
PUBLIC: Return if this is a read all query.

isReadObjectQuery

public boolean isReadObjectQuery()
PUBLIC: Return if this is a read object query.

isReadQuery

public boolean isReadQuery()
PUBLIC: Return if this is a read query.

isReportQuery

public boolean isReportQuery()
PUBLIC: Return if this is a report query.

isSQLCallQuery

public boolean isSQLCallQuery()
PUBLIC: Return true if this query uses an SQL query mechanism .

isUserDefined

public boolean isUserDefined()
INTERNAL: Return true if the query is a custom user defined query.

isWriteObjectQuery

public boolean isWriteObjectQuery()
PUBLIC: Return if this is a write object query.

maintainCache

public void maintainCache()
PUBLIC: Set for the identity map (cache) to be maintained. This is the default.

prepareCall

public void prepareCall(oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
                 throws QueryException
ADVANCED: Pre-generate the call/SQL for the query. This can be used to access the SQL for a query without executing it. To access the call use, query.getCall(), or query.getSQLString() for the SQL. Note the SQL will have argument markers in it (i.e. "?"). To translate these use query.getTranslatedSQLString(session, translationRow).
Throws:
QueryException
See Also:
getCall(), getSQLString(), getTranslatedSQLString(Session, DatabaseRow)

prepareForExecution

public void prepareForExecution()
                         throws QueryException
INTERNAL: Prepare the receiver for execution in a session. In particular, set the descriptor of the receiver to the Descriptor for the appropriate class for the receiver's object.
Throws:
QueryException

redirectQuery

public java.lang.Object redirectQuery(DatabaseQuery queryToRedirect,
                                      oracle.toplink.publicinterface.Session session,
DatabaseRow translationRow)
INTERNAL: Use a TopLink redirector to redirect this query to a method. Added for bug 3241138

remoteExecute

public java.lang.Object remoteExecute(oracle.toplink.publicinterface.Session session)
INTERNAL:

removeProperty

public void removeProperty(java.lang.Object property)
INTERNAL: Property support used by mappings.

replaceValueHoldersIn

public oracle.toplink.internal.helper.IdentityHashtable replaceValueHoldersIn(java.lang.Object object,
                                                                              oracle.toplink.internal.remote.RemoteSessionController controller)
INTERNAL: replace the value holders in the specified result object(s)

rowFromArguments

public DatabaseRow rowFromArguments(java.util.Vector argumentValues)
                             throws QueryException
INTERNAL: Translate argumentValues into a database row.
Throws:
QueryException

setAccessor

public void setAccessor(oracle.toplink.internal.databaseaccess.Accessor accessor)
INTERNAL: Set the accessor, the query must always use the same accessor for database access. This is required to support connection pooling.

setCall

public void setCall(Call call)
PUBLIC: Used to define a store procedure or SQL query.

setCascadePolicy

public void setCascadePolicy(int policyConstant)
INTERNAL: Set the cascade policy.

setDescriptor

public void setDescriptor(Descriptor descriptor)
INTERNAL: Set the descriptor for the query.

setEJBQLString

public void setEJBQLString(java.lang.String ejbqlString)
PUBLIC: To any user of this object. Set the EJBQL string of the query. If arguments are required in the string they will be preceeded by "?" then the argument number.

setHintString

public void setHintString(java.lang.String newHintString)
PUBLIC: Used to set the Oracle Hint string on the query. This should be the full hint string including the comment delimiters This method will cause a query to re-prepare if it has already been executed

setIsUserDefined

public void setIsUserDefined(boolean isUserDefined)
INTERNAL: Set if the query is a custom user defined query.

setName

public void setName(java.lang.String queryName)
PUBLIC: Set the query's name. Queries can be named and added to a descriptor or the session and then referenced by name.

setProperties

public void setProperties(java.util.Hashtable properties)
INTERNAL: Property support used by mappings.

setProperty

public void setProperty(java.lang.Object property,
                        java.lang.Object value)
INTERNAL: Property support used by mappings to stache temporary stuff.

setQueryTimeout

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. If the limit is exceeded, a DatabaseException is thrown. queryTimeout - the new query timeout limit in seconds; zero means unlimited (by default)

setRedirector

public void setRedirector(QueryRedirector redirector)
PUBLIC: Set the query redirector. A redirector can be used in a query to replace its execution with the execution of code. This can be used for named or parameterized queries to allow dynamic configuration of the query base on the query arguments.
See Also:
QueryRedirector

setSelectionCriteria

public void setSelectionCriteria(Expression expression)
PUBLIC: To any user of this object. Set the selection criteria of the query. This method be used when dealing with expressions.

setSession

public void setSession(oracle.toplink.publicinterface.Session session)
INTERNAL: Set the session for the query

setSessionName

public void setSessionName(java.lang.String sessionName)
PUBLIC: Set the name of the session that the query should be executed under. This can be with the session broker to override the default session.

setShouldBindAllParameters

public void setShouldBindAllParameters(boolean shouldBindAllParameters)
PUBLIC: Bind all arguments to any SQL statement.

setShouldCacheStatement

public void setShouldCacheStatement(boolean shouldCacheStatement)
PUBLIC: Cache the prepared statements, this requires full parameter binding as well.

setShouldMaintainCache

public void setShouldMaintainCache(boolean shouldMaintainCache)
PUBLIC: Set if the identity map (cache) should be used or not. If not the cache check will be skipped and the result will not be put into the identity map. By default the identity map is always maintained.

setShouldPrepare

public void setShouldPrepare(boolean shouldPrepare)
PUBLIC: Set if the query should be prepared. TopLink automatically prepares queries to generate their SQL only once, one each execution of the query the SQL does not need to be generated again only the arguments need to be translated. This option is provide to disable this optimization as in can cause problems with certain types of queries that require dynamic SQL basd on their arguments.

These queries include:


setShouldUseWrapperPolicy

public void setShouldUseWrapperPolicy(boolean shouldUseWrapperPolicy)
ADVANCED: The wrapper policy can be enable on a query.

setSQLStatement

public void setSQLStatement(oracle.toplink.internal.expressions.SQLStatement sqlStatement)
PUBLIC: To any user of this object. Set the SQL statement of the query. This method should only be used when dealing with statement objects.

setSQLString

public void setSQLString(java.lang.String sqlString)
PUBLIC: To any user of this object. Set the SQL string of the query. This method should only be used when dealing with user defined SQL strings. If arguments are required in the string they will be preceeded by "#" then the argument name.

setTranslationRow

public void setTranslationRow(DatabaseRow translationRow)
INTERNAL: Set the row for translation

shouldBindAllParameters

public boolean shouldBindAllParameters()
PUBLIC: Bind all arguments to any SQL statement.

shouldCacheStatement

public boolean shouldCacheStatement()
PUBLIC: Cache the prepared statements, this requires full parameter binding as well.

shouldCascadeAllParts

public boolean shouldCascadeAllParts()
PUBLIC: Flag used to determine if all parts should be cascaded

shouldCascadeOnlyDependentParts

public boolean shouldCascadeOnlyDependentParts()
INTERNAL: Flag used for unit of works cascade policy.

shouldCascadeParts

public boolean shouldCascadeParts()
PUBLIC: Flag used to determine if any parts should be cascaded

shouldCascadePrivateParts

public boolean shouldCascadePrivateParts()
PUBLIC: Flag used to determine if any private parts should be cascaded

shouldIgnoreBindAllParameters

public boolean shouldIgnoreBindAllParameters()
PUBLIC: Local shouldBindAllParameters() should be ignored, Session's shouldBindAllParameters() should be used.

shouldIgnoreCacheStatement

public boolean shouldIgnoreCacheStatement()
PUBLIC: Local shouldCacheStatement() should be ignored, Session's shouldCacheAllStatements() should be used.

shouldMaintainCache

public boolean shouldMaintainCache()
PUBLIC: Return if the identity map (cache) should be used or not. If not the cache check will be skipped and the result will not be put into the identity map. By default the identity map is always maintained.

shouldIgnoreMaintainCache

public boolean shouldIgnoreMaintainCache()
INTERNAL: Local shouldMaintainCache() should be ignored, Descriptor's shouldDisableCacheHits() should be used.

shouldPrepare

public boolean shouldPrepare()
PUBLIC: Return if the query should be prepared. TopLink automatically prepares queries to generate their SQL only once, one each execution of the query the SQL does not need to be generated again only the arguments need to be translated. This option is provide to disable this optimization as in can cause problems with certain types of queries that require dynamic SQL basd on their arguments.

These queries include:


shouldUseWrapperPolicy

public boolean shouldUseWrapperPolicy()
ADVANCED: The wrapper policy can be enabled on a query.

toString

public java.lang.String toString()

Copyright © 1998, 2004 Oracle Corporation. All Rights Reserved.