EclipseLink 2.2.0, build 'v20110202-r8913' API Reference

org.eclipse.persistence.queries
Class ModifyAllQuery

java.lang.Object
  extended by org.eclipse.persistence.queries.DatabaseQuery
      extended by org.eclipse.persistence.queries.ModifyQuery
          extended by org.eclipse.persistence.queries.ModifyAllQuery
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DeleteAllQuery, UpdateAllQuery

public abstract class ModifyAllQuery
extends ModifyQuery

PUBLIC: Query used to perform a bulk delete using the expression framework.

See Also:
Serialized Form
Author:
Andrei Ilitchev

Field Summary
protected  ExpressionBuilder defaultBuilder
          Provide a default builder so that it's easier to be consistent
static int INVALIDATE_CACHE
           
protected  boolean isPreparedUsingTempStorage
          Indicates whether the query was prepared so that it will execute using temp storage
static int NO_CACHE
          Cache usage flags
protected  java.lang.Class referenceClass
           
protected  java.lang.String referenceClassName
           
protected  java.lang.Integer result
          Number of modified objects
 
Fields inherited from class org.eclipse.persistence.queries.ModifyQuery
forceBatchStatementExecution, modifyRow
 
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
 
Constructor Summary
ModifyAllQuery()
          PUBLIC:
ModifyAllQuery(java.lang.Class referenceClass)
          PUBLIC: Create a new update all query for the class specified.
ModifyAllQuery(java.lang.Class referenceClass, Expression selectionCriteria)
          PUBLIC: Create a new update all query for the class and the selection criteria specified.
 
Method Summary
protected  void clonedQueryExecutionComplete(DatabaseQuery query, org.eclipse.persistence.internal.sessions.AbstractSession session)
          INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query.
 java.lang.Object executeInUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
          INTERNAL: Override query execution where Session is a UnitOfWork.
 int getCacheUsage()
          PUBLIC: Return the cache usage for this query.
 ExpressionBuilder getExpressionBuilder()
          PUBLIC: Get the expression builder which should be used for this query.
 java.lang.Class getReferenceClass()
          PUBLIC: Return the reference class for this query.
 java.lang.String getReferenceClassName()
          INTERNAL: Return the name of the reference class of the query.
protected  void initializeDefaultBuilder()
          INTERNAL: Initialize the expression builder which should be used for this query.
protected  void initializeQuerySpecificDefaultBuilder()
          INTERNAL: Initialize the expression builder which should be used for this query.
protected  void invalidateCache()
          INTERNAL: Invalid the cache, that is, those objects in the cache that were affected by the query.
 boolean isModifyQuery()
          PUBLIC: Return true if this is a modify query.
 boolean isPreparedUsingTempStorage()
          INTERNAL:
 void mergeChangesIntoSharedCache()
          INTERNAL: After execution we need to merge the changes into the shared cache, unless the query has been tagged to bypass on the store.
 void setCacheUsage(int cacheUsage)
          PUBLIC: Set the level of cache support for this query, either NONE or INVALIDATE.
 void setExpressionBuilder(ExpressionBuilder builder)
          INTERNAL Sets the default expression builder for this query.
 void setIsPreparedUsingTempStorage(boolean isPreparedUsingTempStorage)
          INTERNAL:
 void setReferenceClass(java.lang.Class referenceClass)
          PUBLIC: Set the reference class this query.
 void setReferenceClassName(java.lang.String className)
          INTERNAL: Set the class name of the reference class of this query.
 void setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW)
          PUBLIC: Set a flag indicating whether execution should be deferred in UOW until commit.
 boolean shouldDeferExecutionInUOW()
          PUBLIC: Indicates whether execution should be deferred in UOW until commit.
protected  boolean shouldInvalidateCache()
          INTERNAL:
 
Methods inherited from class org.eclipse.persistence.queries.ModifyQuery
forceBatchStatementExecution, getModifyRow, setForceBatchStatementExecution, setModifyRow
 
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, clone, convertClassNamesToClasses, copyFromQuery, dontBindAllParameters, dontCacheStatement, dontCascadeParts, dontMaintainCache, execute, executeDatabaseQuery, 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, isDefaultPropertiesQuery, isDeleteAllQuery, isDeleteObjectQuery, isDirectReadQuery, isExecutionClone, isExpressionQuery, isInsertObjectQuery, isJPQLCallQuery, isModifyAllQuery, isNativeConnectionRequired, isObjectBuildingQuery, isObjectLevelModifyQuery, isObjectLevelReadQuery, isPrepared, isReadAllQuery, isReadObjectQuery, isReadQuery, isReportQuery, isSQLCallQuery, isUpdateAllQuery, isUpdateObjectQuery, isUserDefined, isValueReadQuery, isWriteObjectQuery, maintainCache, prepare, prepareCall, prepareCustomQuery, prepareForExecution, prepareForRemoteExecution, prepareFromQuery, redirectQuery, remoteExecute, 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
 

Field Detail

NO_CACHE

public static final int NO_CACHE
Cache usage flags

See Also:
Constant Field Values

INVALIDATE_CACHE

public static final int INVALIDATE_CACHE
See Also:
Constant Field Values

referenceClass

protected java.lang.Class referenceClass

referenceClassName

protected java.lang.String referenceClassName

result

protected transient java.lang.Integer result
Number of modified objects


defaultBuilder

protected ExpressionBuilder defaultBuilder
Provide a default builder so that it's easier to be consistent


isPreparedUsingTempStorage

protected boolean isPreparedUsingTempStorage
Indicates whether the query was prepared so that it will execute using temp storage

Constructor Detail

ModifyAllQuery

public ModifyAllQuery()
PUBLIC:


ModifyAllQuery

public ModifyAllQuery(java.lang.Class referenceClass)
PUBLIC: Create a new update all query for the class specified.


ModifyAllQuery

public ModifyAllQuery(java.lang.Class referenceClass,
                      Expression selectionCriteria)
PUBLIC: Create a new update all query for the class and the selection criteria specified.

Method Detail

isModifyQuery

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

Overrides:
isModifyQuery in class ModifyQuery

setIsPreparedUsingTempStorage

public void setIsPreparedUsingTempStorage(boolean isPreparedUsingTempStorage)
INTERNAL:


isPreparedUsingTempStorage

public boolean isPreparedUsingTempStorage()
INTERNAL:


clonedQueryExecutionComplete

protected void clonedQueryExecutionComplete(DatabaseQuery query,
                                            org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query. The clones of all the ModifyAllQueries will be added to modifyAllQueries for validation.

Overrides:
clonedQueryExecutionComplete in class DatabaseQuery

executeInUnitOfWork

public java.lang.Object executeInUnitOfWork(org.eclipse.persistence.internal.sessions.UnitOfWorkImpl unitOfWork,
                                            org.eclipse.persistence.internal.sessions.AbstractRecord translationRow)
                                     throws DatabaseException,
                                            OptimisticLockException
INTERNAL: Override query execution where Session is a UnitOfWork.

If there are objects in the cache return the results of the cache lookup.

Overrides:
executeInUnitOfWork in class DatabaseQuery
Parameters:
unitOfWork - - the session in which the receiver will be executed.
translationRow - - the arguments
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.

getCacheUsage

public int getCacheUsage()
PUBLIC: Return the cache usage for this query.


getExpressionBuilder

public ExpressionBuilder getExpressionBuilder()
PUBLIC: Get the expression builder which should be used for this query. This expression builder should be used to build all expressions used by this query.


setExpressionBuilder

public void setExpressionBuilder(ExpressionBuilder builder)
INTERNAL Sets the default expression builder for this query.


getReferenceClassName

public java.lang.String getReferenceClassName()
INTERNAL: Return the name of the reference class of the query. Used by the Mapping Workbench to avoid classpath dependencies

Overrides:
getReferenceClassName in class DatabaseQuery

getReferenceClass

public java.lang.Class getReferenceClass()
PUBLIC: Return the reference class for this query.

Overrides:
getReferenceClass in class DatabaseQuery

invalidateCache

protected void invalidateCache()
INTERNAL: Invalid the cache, that is, those objects in the cache that were affected by the query.


mergeChangesIntoSharedCache

public void mergeChangesIntoSharedCache()
INTERNAL: After execution we need to merge the changes into the shared cache, unless the query has been tagged to bypass on the store.


setCacheUsage

public void setCacheUsage(int cacheUsage)
PUBLIC: Set the level of cache support for this query, either NONE or INVALIDATE.


setReferenceClass

public void setReferenceClass(java.lang.Class referenceClass)
PUBLIC: Set the reference class this query.


setReferenceClassName

public void setReferenceClassName(java.lang.String className)
INTERNAL: Set the class name of the reference class of this query. Used by the Mapping Workbench to avoid classpath dependencies.


setShouldDeferExecutionInUOW

public void setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW)
PUBLIC: Set a flag indicating whether execution should be deferred in UOW until commit.


shouldDeferExecutionInUOW

public boolean shouldDeferExecutionInUOW()
PUBLIC: Indicates whether execution should be deferred in UOW until commit.


shouldInvalidateCache

protected boolean shouldInvalidateCache()
INTERNAL:


initializeDefaultBuilder

protected void initializeDefaultBuilder()
INTERNAL: Initialize the expression builder which should be used for this query. If there is a where clause, use its expression builder, otherwise generate one and cache it. This helps avoid unnecessary rebuilds.


initializeQuerySpecificDefaultBuilder

protected void initializeQuerySpecificDefaultBuilder()
INTERNAL: Initialize the expression builder which should be used for this query. If there is a where clause, use its expression builder. If after this method defaultBuilder is still null, then initializeDefaultBuilder method will generate and cache it.


EclipseLink 2.2.0, build 'v20110202-r8913' API Reference