Top Description Inners Fields Constructors Methods
org.hibernate.action

public Class BulkOperationCleanupAction

extends Object
implements Executable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.action.Executable
Imports
java.io.Serializable, java.util.Arrays, .HashSet, .Iterator, .LinkedHashSet, .Set, org.hibernate.HibernateException, org.hibernate.cache.access.CollectionRegionAccessStrategy, .EntityRegionAccessStrategy, .SoftLock, org.hibernate.engine.SessionFactoryImplementor, .SessionImplementor, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, .Queryable

An org.hibernate.engine.ActionQueue Executable for ensuring shared cache cleanup in relation to performed bulk HQL queries.

Note

currently this executes for INSERT queries as well as UPDATE and DELETE queries. For INSERT it is really not needed as we'd have no invalid entity/collection data to cleanup (we'd still nee to invalidate the appropriate update-timestamps regions) as a result of this query.

Author
Steve Ebersole

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class

Field Summary

Modifier and TypeField and Description
private final Serializable[]
private final Set<BulkOperationCleanupAction.CollectionCleanup>
private final Set<BulkOperationCleanupAction.EntityCleanup>

Constructor Summary

AccessConstructor and Description
public
BulkOperationCleanupAction(SessionImplementor
The session to which this request is tied.
session
,
Queryable[]
The affected entity persisters.
affectedQueryables
)

Constructs an action to cleanup "affected cache regions" based on the affected entity persisters.

public
BulkOperationCleanupAction(SessionImplementor
The session to which this request is tied.
session
,
Set<E>
The table spaces.
tableSpaces
)

Constructs an action to cleanup "affected cache regions" based on a set of affected table spaces.

Method Summary

Modifier and TypeMethod and Description
private boolean

Returns:

True if there are affected table spaces and any of the incoming check table spaces occur in that set.
affectedEntity
(Set<E>
The table spaces reported to be affected by the query.
affectedTableSpaces
,
Serializable[]
The table spaces (from the entity persister) to check against the affected table spaces.
checkTableSpaces
)

Check to determine whether the table spaces reported by an entity persister match against the defined affected table spaces.

public void
beforeExecutions()

Implements org.hibernate.action.Executable.beforeExecutions.

Called before executing any actions.
public void
execute()

Implements org.hibernate.action.Executable.execute.

Execute this action
public AfterTransactionCompletionProcess
getAfterTransactionCompletionProcess()

Implements org.hibernate.action.Executable.getAfterTransactionCompletionProcess.

Get the after-transaction-completion process, if any, for this action.
public BeforeTransactionCompletionProcess
getBeforeTransactionCompletionProcess()

Implements org.hibernate.action.Executable.getBeforeTransactionCompletionProcess.

Get the before-transaction-completion process, if any, for this action.
public Serializable[]
getPropertySpaces()

Implements org.hibernate.action.Executable.getPropertySpaces.

What spaces (tables) are affected by this action?
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

affectedTableSpacesback to summary
private final Serializable[] affectedTableSpaces
collectionCleanupsback to summary
private final Set<BulkOperationCleanupAction.CollectionCleanup> collectionCleanups
entityCleanupsback to summary
private final Set<BulkOperationCleanupAction.EntityCleanup> entityCleanups

Constructor Detail

BulkOperationCleanupActionback to summary
public BulkOperationCleanupAction(SessionImplementor session, Queryable[] affectedQueryables)

Constructs an action to cleanup "affected cache regions" based on the affected entity persisters. The affected regions are defined as the region (if any) of the entity persisters themselves, plus the collection regions for any collection in which those entity persisters participate as elements/keys/etc.

Parameters
session:SessionImplementor

The session to which this request is tied.

affectedQueryables:Queryable[]

The affected entity persisters.

BulkOperationCleanupActionback to summary
public BulkOperationCleanupAction(SessionImplementor session, Set<E> tableSpaces)

Constructs an action to cleanup "affected cache regions" based on a set of affected table spaces. This differs from BulkOperationCleanupAction(SessionImplementor, Queryable[]) in that here we have the affected table names. From those we deduce the entity persisters which are affected based on the defined table spaces; and from there, we determine the affected collection regions based on any collections in which those entity persisters participate as elements/keys/etc.

Parameters
session:SessionImplementor

The session to which this request is tied.

tableSpaces:Set<E>

The table spaces.

Annotations
@SuppressWarnings:unchecked

Method Detail

affectedEntityback to summary
private boolean affectedEntity(Set<E> affectedTableSpaces, Serializable[] checkTableSpaces)

Check to determine whether the table spaces reported by an entity persister match against the defined affected table spaces.

Parameters
affectedTableSpaces:Set<E>

The table spaces reported to be affected by the query.

checkTableSpaces:Serializable[]

The table spaces (from the entity persister) to check against the affected table spaces.

Returns:boolean

True if there are affected table spaces and any of the incoming check table spaces occur in that set.

beforeExecutionsback to summary
public void beforeExecutions() throws HibernateException

Implements org.hibernate.action.Executable.beforeExecutions.

Doc from org.hibernate.action.Executable.beforeExecutions.

Called before executing any actions. Gives actions a chance to perform any preparation.

Exceptions
HibernateException:
Indicates a problem during preparation.
executeback to summary
public void execute() throws HibernateException

Implements org.hibernate.action.Executable.execute.

Doc from org.hibernate.action.Executable.execute.

Execute this action

Exceptions
HibernateException:
Indicates a problem during execution.
getAfterTransactionCompletionProcessback to summary
public AfterTransactionCompletionProcess getAfterTransactionCompletionProcess()

Implements org.hibernate.action.Executable.getAfterTransactionCompletionProcess.

Doc from org.hibernate.action.Executable.getAfterTransactionCompletionProcess.

Get the after-transaction-completion process, if any, for this action.

Returns:AfterTransactionCompletionProcess

The after-transaction-completion process, or null if we have no after-transaction-completion process

getBeforeTransactionCompletionProcessback to summary
public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess()

Implements org.hibernate.action.Executable.getBeforeTransactionCompletionProcess.

Doc from org.hibernate.action.Executable.getBeforeTransactionCompletionProcess.

Get the before-transaction-completion process, if any, for this action.

Returns:BeforeTransactionCompletionProcess

The before-transaction-completion process, or null if we have no before-transaction-completion process

getPropertySpacesback to summary
public Serializable[] getPropertySpaces()

Implements org.hibernate.action.Executable.getPropertySpaces.

Doc from org.hibernate.action.Executable.getPropertySpaces.

What spaces (tables) are affected by this action?

Returns:Serializable[]

The spaces affected by this action.

org.hibernate.action back to summary

private Class BulkOperationCleanupAction.CollectionCleanup

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.action.BulkOperationCleanupAction.CollectionCleanup

Field Summary

Modifier and TypeField and Description
private final CollectionRegionAccessStrategy
private final SoftLock

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheAccessback to summary
private final CollectionRegionAccessStrategy cacheAccess
cacheLockback to summary
private final SoftLock cacheLock

Constructor Detail

CollectionCleanupback to summary
private CollectionCleanup(CollectionRegionAccessStrategy cacheAccess)

Method Detail

releaseback to summary
private void release()
org.hibernate.action back to summary

private Class BulkOperationCleanupAction.EntityCleanup

extends Object
Class Inheritance
  • java.lang.Object
  • org.hibernate.action.BulkOperationCleanupAction.EntityCleanup

Field Summary

Modifier and TypeField and Description
private final EntityRegionAccessStrategy
private final SoftLock

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheAccessback to summary
private final EntityRegionAccessStrategy cacheAccess
cacheLockback to summary
private final SoftLock cacheLock

Constructor Detail

EntityCleanupback to summary
private EntityCleanup(EntityRegionAccessStrategy cacheAccess)

Method Detail

releaseback to summary
private void release()