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

public abstract Class ModifyAllQuery

extends ModifyQuery
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.queries.UpdateAllQuery, org.eclipse.persistence.queries.DeleteAllQuery
Imports
org.eclipse.persistence.exceptions.*, org.eclipse.persistence.expressions.*, org.eclipse.persistence.internal.queries.DatabaseQueryMechanism, .ExpressionQueryMechanism, org.eclipse.persistence.internal.sessions.AbstractRecord, .UnitOfWorkImpl, .AbstractSession

PUBLIC: Query used to perform a bulk delete using the expression framework.
Author
Andrei Ilitchev
Since
August 18, 2005

Field Summary

Modifier and TypeField and Description
protected ExpressionBuilder
defaultBuilder

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

public static final int
protected boolean
isPreparedUsingTempStorage

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

private int
public static final int
NO_CACHE

Cache usage flags

protected Class<?>
protected String
protected transient Integer
result

Number of modified objects

private boolean
shouldDeferExecutionInUOW

Indicates whether execution should be deferred in UOW

Inherited from org.eclipse.persistence.queries.ModifyQuery:
forceBatchStatementExecutionisBatchExecutionSupportedmodifyRow

Constructor Summary

AccessConstructor and Description
protected
ModifyAllQuery()

PUBLIC:

protected
ModifyAllQuery(Class<?> referenceClass)

PUBLIC: Create a new update all query for the class specified.

protected
ModifyAllQuery(Class<?> referenceClass, Expression selectionCriteria)

PUBLIC: Create a new update all query for the class and the selection criteria specified.

Method Summary

Modifier and TypeMethod and Description
protected void
clonedQueryExecutionComplete(DatabaseQuery query, AbstractSession session)

Overrides org.eclipse.persistence.queries.DatabaseQuery.clonedQueryExecutionComplete.

INTERNAL Used to give the subclasses opportunity to copy aspects of the cloned query to the original query.
public Object

Returns:

An object, the result of executing the query.
executeInUnitOfWork
(UnitOfWorkImpl
- the session in which the receiver will be executed.
unitOfWork
,
AbstractRecord
- the arguments
translationRow
)

Overrides org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork.

INTERNAL: Override query execution where Session is a UnitOfWork.
public int
getCacheUsage()

PUBLIC: Return the cache usage for this query.

public ExpressionBuilder
getExpressionBuilder()

PUBLIC: Get the expression builder which should be used for this query.

public Class<?>
getReferenceClass()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getReferenceClass.

PUBLIC: Return the reference class for this query.
public String
getReferenceClassName()

Overrides org.eclipse.persistence.queries.DatabaseQuery.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.

public boolean
isModifyAllQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isModifyAllQuery.

PUBLIC: Return true if this is a modify all query.
public boolean
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.

public void
setCacheUsage(int cacheUsage)

PUBLIC: Set the level of cache support for this query, either NONE or INVALIDATE.

public void
setExpressionBuilder(ExpressionBuilder builder)

INTERNAL Sets the default expression builder for this query.

public void
setIsPreparedUsingTempStorage(boolean isPreparedUsingTempStorage)

INTERNAL:

public void
setReferenceClass(Class<?> referenceClass)

PUBLIC: Set the reference class this query.

public void
setReferenceClassName(String className)

INTERNAL: Set the class name of the reference class of this query.

public void
setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW)

PUBLIC: Set a flag indicating whether execution should be deferred in UOW until commit.

public boolean
shouldDeferExecutionInUOW()

PUBLIC: Indicates whether execution should be deferred in UOW until commit.

protected boolean
Inherited from org.eclipse.persistence.queries.ModifyQuery:
forceBatchStatementExecutiongetModifyRowisBatchExecutionSupportedisModifyQuerysetForceBatchStatementExecutionsetIsBatchExecutionSupportedsetModifyRow

Field Detail

defaultBuilderback to summary
protected ExpressionBuilder defaultBuilder

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

INVALIDATE_CACHEback to summary
public static final int INVALIDATE_CACHE
isPreparedUsingTempStorageback to summary
protected boolean isPreparedUsingTempStorage

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

m_cacheUsageback to summary
private int m_cacheUsage
NO_CACHEback to summary
public static final int NO_CACHE

Cache usage flags

referenceClassback to summary
protected Class<?> referenceClass
referenceClassNameback to summary
protected String referenceClassName
resultback to summary
protected transient Integer result

Number of modified objects

shouldDeferExecutionInUOWback to summary
private boolean shouldDeferExecutionInUOW

Indicates whether execution should be deferred in UOW

Constructor Detail

ModifyAllQueryback to summary
protected ModifyAllQuery()

PUBLIC:

ModifyAllQueryback to summary
protected ModifyAllQuery(Class<?> referenceClass)

PUBLIC: Create a new update all query for the class specified.

ModifyAllQueryback to summary
protected ModifyAllQuery(Class<?> referenceClass, Expression selectionCriteria)

PUBLIC: Create a new update all query for the class and the selection criteria specified.

Method Detail

clonedQueryExecutionCompleteback to summary
protected void clonedQueryExecutionComplete(DatabaseQuery query, AbstractSession session)

Overrides org.eclipse.persistence.queries.DatabaseQuery.clonedQueryExecutionComplete.

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.

Annotations
@Override
executeInUnitOfWorkback to summary
public Object executeInUnitOfWork(UnitOfWorkImpl unitOfWork, AbstractRecord translationRow) throws DatabaseException, OptimisticLockException

Overrides org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork.

INTERNAL: Override query execution where Session is a UnitOfWork.

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

Parameters
unitOfWork:UnitOfWorkImpl

- the session in which the receiver will be executed.

translationRow:AbstractRecord

- the arguments

Returns:Object

An object, the result of executing the query.

Annotations
@Override
Exceptions
DatabaseException:
- an error has occurred on the database.
OptimisticLockException:
- an error has occurred using the optimistic lock feature.
getCacheUsageback to summary
public int getCacheUsage()

PUBLIC: Return the cache usage for this query.

getExpressionBuilderback to summary
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.

getReferenceClassback to summary
public Class<?> getReferenceClass()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getReferenceClass.

PUBLIC: Return the reference class for this query.

Annotations
@Override
getReferenceClassNameback to summary
public String getReferenceClassName()

Overrides org.eclipse.persistence.queries.DatabaseQuery.getReferenceClassName.

INTERNAL: Return the name of the reference class of the query. Used by the Mapping Workbench to avoid classpath dependencies

Annotations
@Override
initializeDefaultBuilderback to summary
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.

initializeQuerySpecificDefaultBuilderback to summary
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.

invalidateCacheback to summary
protected void invalidateCache()

INTERNAL: Invalid the cache, that is, those objects in the cache that were affected by the query.

isModifyAllQueryback to summary
public boolean isModifyAllQuery()

Overrides org.eclipse.persistence.queries.DatabaseQuery.isModifyAllQuery.

PUBLIC: Return true if this is a modify all query.

Annotations
@Override
isPreparedUsingTempStorageback to summary
public boolean isPreparedUsingTempStorage()

INTERNAL:

mergeChangesIntoSharedCacheback to summary
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.

setCacheUsageback to summary
public void setCacheUsage(int cacheUsage)

PUBLIC: Set the level of cache support for this query, either NONE or INVALIDATE.

setExpressionBuilderback to summary
public void setExpressionBuilder(ExpressionBuilder builder)

INTERNAL Sets the default expression builder for this query.

setIsPreparedUsingTempStorageback to summary
public void setIsPreparedUsingTempStorage(boolean isPreparedUsingTempStorage)

INTERNAL:

setReferenceClassback to summary
public void setReferenceClass(Class<?> referenceClass)

PUBLIC: Set the reference class this query.

setReferenceClassNameback to summary
public void setReferenceClassName(String className)

INTERNAL: Set the class name of the reference class of this query. Used by the Mapping Workbench to avoid classpath dependencies.

setShouldDeferExecutionInUOWback to summary
public void setShouldDeferExecutionInUOW(boolean shouldDeferExecutionInUOW)

PUBLIC: Set a flag indicating whether execution should be deferred in UOW until commit.

shouldDeferExecutionInUOWback to summary
public boolean shouldDeferExecutionInUOW()

PUBLIC: Indicates whether execution should be deferred in UOW until commit.

shouldInvalidateCacheback to summary
protected boolean shouldInvalidateCache()

INTERNAL: