Top Description Inners Fields Constructors Methods
org.hibernate.action.internal

public Class BulkOperationCleanupAction

extends Object
implements Executable, Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable, org.hibernate.action.spi.Executable
Imports
java.io.Serializable, java.util.ArrayList, .Collections, .HashSet, .LinkedHashSet, .List, .Set, org.hibernate.HibernateException, org.hibernate.action.spi.AfterTransactionCompletionProcess, .BeforeTransactionCompletionProcess, .Executable, org.hibernate.cache.spi.access.CollectionDataAccess, .EntityDataAccess, .NaturalIdDataAccess, .SoftLock, org.hibernate.engine.spi.SharedSessionContractImplementor, org.hibernate.event.spi.EventSource, org.hibernate.metamodel.spi.MappingMetamodelImplementor, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.query.sqm.tree.SqmDmlStatement, .SqmQuery, org.hibernate.query.sqm.tree.cte.SqmCteStatement, org.hibernate.sql.ast.tree.insert.InsertSelectStatement

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

Implementation 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 clean up (we'd still need 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
private static class

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
BulkOperationCleanupAction(SharedSessionContractImplementor
The session to which this request is tied.
session
,
EntityPersister...
The affected entity persisters.
affectedQueryables
)

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

public
BulkOperationCleanupAction(SharedSessionContractImplementor
The session to which this request is tied.
session
,
Set<String>
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:

Whether the entity should be considered affected
affectedEntity
(Set<?>
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 whether we should consider an entity as affected by the query.

public void
afterDeserialize(EventSource
The session being deserialized; must be an EventSource
session
)

Implements org.hibernate.action.spi.Executable.afterDeserialize.

Reconnect to session after deserialization
public void
beforeExecutions()

Implements org.hibernate.action.spi.Executable.beforeExecutions.

Called before executing any actions.
public void
execute()

Implements org.hibernate.action.spi.Executable.execute.

Execute this action.
public AfterTransactionCompletionProcess
getAfterTransactionCompletionProcess()

Implements org.hibernate.action.spi.Executable.getAfterTransactionCompletionProcess.

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

Implements org.hibernate.action.spi.Executable.getBeforeTransactionCompletionProcess.

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

Implements org.hibernate.action.spi.Executable.getPropertySpaces.

What spaces (tables) are affected by this action?
public static void
public static void
public static void
schedule(SharedSessionContractImplementor session, Set<String> affectedQueryables)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

affectedTableSpacesback to summary
private final String[] affectedTableSpaces
collectionCleanupsback to summary
private final Set<BulkOperationCleanupAction.CollectionCleanup> collectionCleanups
entityCleanupsback to summary
private final Set<BulkOperationCleanupAction.EntityCleanup> entityCleanups
naturalIdCleanupsback to summary
private final Set<BulkOperationCleanupAction.NaturalIdCleanup> naturalIdCleanups

Constructor Detail

BulkOperationCleanupActionback to summary
public BulkOperationCleanupAction(SharedSessionContractImplementor session, EntityPersister... 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:SharedSessionContractImplementor

The session to which this request is tied.

affectedQueryables:EntityPersister[]

The affected entity persisters.

BulkOperationCleanupActionback to summary
public BulkOperationCleanupAction(SharedSessionContractImplementor session, Set<String> tableSpaces)

Constructs an action to cleanup "affected cache regions" based on a set of affected table spaces. This differs from BulkOperationCleanupAction(SharedSessionContractImplementor, EntityPersister[]) 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. Finally, we determine the affected collection regions based on any collections in which those entity persisters participate as elements/keys/etc.

Parameters
session:SharedSessionContractImplementor

The session to which this request is tied.

tableSpaces:Set<String>

The table spaces.

Method Detail

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

Check whether we should consider an entity as affected by the query. This defines inclusion of the entity in the clean-up.

Implementation Note

An entity is considered to be affected if either (1) the affected table spaces are not known or (2) any of the incoming check table spaces occur in that set.

Parameters
affectedTableSpaces:Set<?>

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

Whether the entity should be considered affected

afterDeserializeback to summary
public void afterDeserialize(EventSource session)

Implements org.hibernate.action.spi.Executable.afterDeserialize.

Doc from org.hibernate.action.spi.Executable.afterDeserialize.

Reconnect to session after deserialization

Parameters
session:EventSource

The session being deserialized; must be an EventSource

Annotations
@Override
beforeExecutionsback to summary
public void beforeExecutions() throws HibernateException

Implements org.hibernate.action.spi.Executable.beforeExecutions.

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

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

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

Implements org.hibernate.action.spi.Executable.execute.

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

Execute this action.

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

Implements org.hibernate.action.spi.Executable.getAfterTransactionCompletionProcess.

Doc from org.hibernate.action.spi.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

Annotations
@Override
getBeforeTransactionCompletionProcessback to summary
public BeforeTransactionCompletionProcess getBeforeTransactionCompletionProcess()

Implements org.hibernate.action.spi.Executable.getBeforeTransactionCompletionProcess.

Doc from org.hibernate.action.spi.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

Annotations
@Override
getPropertySpacesback to summary
public String[] getPropertySpaces()

Implements org.hibernate.action.spi.Executable.getPropertySpaces.

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

What spaces (tables) are affected by this action?

Returns:String[]

The spaces affected by this action.

Annotations
@Override
scheduleback to summary
public static void schedule(SharedSessionContractImplementor session, SqmDmlStatement<?> statement)
scheduleback to summary
public static void schedule(SharedSessionContractImplementor session, EntityPersister... affectedQueryables)
scheduleback to summary
public static void schedule(SharedSessionContractImplementor session, Set<String> affectedQueryables)
org.hibernate.action.internal back to summary

private Class BulkOperationCleanupAction.CollectionCleanup

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • org.hibernate.action.internal.BulkOperationCleanupAction.CollectionCleanup
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
private final CollectionDataAccess
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 CollectionDataAccess cacheAccess
cacheLockback to summary
private final SoftLock cacheLock

Constructor Detail

CollectionCleanupback to summary
private CollectionCleanup(CollectionDataAccess cacheAccess, SharedSessionContractImplementor session)

Method Detail

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

private Class BulkOperationCleanupAction.EntityCleanup

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • org.hibernate.action.internal.BulkOperationCleanupAction.EntityCleanup
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
private final EntityDataAccess
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 EntityDataAccess cacheAccess
cacheLockback to summary
private final SoftLock cacheLock

Constructor Detail

EntityCleanupback to summary
private EntityCleanup(EntityDataAccess cacheAccess, SharedSessionContractImplementor session)

Method Detail

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

private Class BulkOperationCleanupAction.NaturalIdCleanup

extends Object
implements Serializable
Class Inheritance
  • java.lang.Object
  • org.hibernate.action.internal.BulkOperationCleanupAction.NaturalIdCleanup
All Implemented Interfaces
java.io.Serializable

Field Summary

Modifier and TypeField and Description
private final SoftLock
private final NaturalIdDataAccess

Constructor Summary

AccessConstructor and Description
public

Method Summary

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

Field Detail

cacheLockback to summary
private final SoftLock cacheLock
naturalIdCacheAccessStrategyback to summary
private final NaturalIdDataAccess naturalIdCacheAccessStrategy

Constructor Detail

NaturalIdCleanupback to summary
public NaturalIdCleanup(NaturalIdDataAccess naturalIdCacheAccessStrategy, SharedSessionContractImplementor session)

Method Detail

releaseback to summary
private void release()