public class ReactiveActionQueue extends Object
ActionQueue
, where DML operations are queued before execution during a flush.Constructor and Description |
---|
ReactiveActionQueue(ReactiveSession session) Constructs an action queue bound to the given session. |
Modifier and Type | Method and Description |
---|---|
void | addAction(BulkOperationCleanupAction action) Adds an action defining a cleanup relating to a bulk operation (HQL/JPQL or Criteria based update/delete) |
void | addAction(CollectionRecreateAction action) Adds a collection (re)create action |
void | addAction(CollectionRemoveAction action) Adds a collection remove action |
void | addAction(CollectionUpdateAction action) Adds a collection update action |
void | addAction(OrphanRemovalAction action) Adds an orphan removal action |
void | addAction(QueuedOperationCollectionAction action) Adds an action relating to a collection queued operation (extra lazy). |
void | addAction(ReactiveEntityDeleteAction action) Adds an entity delete action |
CompletionStage<Void> | addAction(ReactiveEntityIdentityInsertAction action) Adds an entity (IDENTITY) insert action |
CompletionStage<Void> | addAction(ReactiveEntityRegularInsertAction action) |
CompletionStage<Void> | afterTransactionCompletion(boolean success) Performs cleanup of any held cache softlocks. |
boolean | areInsertionsOrDeletionsQueued() Check whether any insertion or deletion actions are currently queued. |
boolean | areTablesToBeUpdated(Set tables) Check whether the given tables/query-spaces are to be executed against given the currently queued actions. |
CompletionStage<Void> | beforeTransactionCompletion() Execute any registered org.hibernate.action.spi.BeforeTransactionCompletionProcess |
void | checkNoUnresolvedActionsAfterOperation() Throws org.hibernate.PropertyValueException if there are any unresolved entity insert actions that depend on non-nullable associations with a transient entity. |
void | clear() |
void | clearFromFlushNeededCheck(int previousCollectionRemovalSize) |
<E extends ReactiveExecutable> | execute(E executable) |
CompletionStage<Void> | executeActions() Perform all currently queued actions. |
CompletionStage<Void> | executeInserts() Perform all currently queued entity-insertion actions. |
boolean | hasAfterTransactionActions() |
boolean | hasAnyQueuedActions() |
boolean | hasBeforeTransactionActions() |
boolean | hasUnresolvedEntityInsertActions() Are there unresolved entity insert actions that depend on non-nullable associations with a transient entity? |
int | numberOfCollectionCreations() |
int | numberOfCollectionRemovals() |
int | numberOfCollectionUpdates() |
int | numberOfDeletions() |
int | numberOfInsertions() |
int | numberOfUpdates() |
void | prepareActions() Prepares the internal action queues for execution. |
void | registerProcess(AfterTransactionCompletionProcess process) |
void | registerProcess(BeforeTransactionCompletionProcess process) |
void | sortActions() |
void | sortCollectionActions() |
String | toString() Returns a string representation of the object. |
void | unScheduleDeletion(EntityEntry entry, Object rescuedEntity) |
public ReactiveActionQueue(ReactiveSession session)
session
- The session "owning" this queue.public void clear()
public CompletionStage<Void> addAction(ReactiveEntityRegularInsertAction action)
public CompletionStage<Void> addAction(ReactiveEntityIdentityInsertAction action)
action
- The action representing the entity insertionpublic void addAction(ReactiveEntityDeleteAction action)
action
- The action representing the entity deletionpublic void addAction(OrphanRemovalAction action)
action
- The action representing the orphan removalpublic void addAction(CollectionRecreateAction action)
action
- The action representing the (re)creation of a collectionpublic void addAction(CollectionRemoveAction action)
action
- The action representing the removal of a collectionpublic void addAction(CollectionUpdateAction action)
action
- The action representing the update of a collectionpublic void addAction(QueuedOperationCollectionAction action)
action
- The action representing the queued operationpublic void addAction(BulkOperationCleanupAction action)
action
- The action representing the queued operationpublic boolean hasUnresolvedEntityInsertActions()
public void checkNoUnresolvedActionsAfterOperation() throws PropertyValueException
org.hibernate.PropertyValueException
if there are any unresolved entity insert actions that depend on non-nullable associations with a transient entity. This method should be called on completion of an operation (after all cascades are completed) that saves an entity.org.hibernate.PropertyValueException
- if there are any unresolved entity insert actions; org.hibernate.PropertyValueException#getEntityName()
and org.hibernate.PropertyValueException#getPropertyName()
will return the entity name and property value for the first unresolved entity insert action.PropertyValueException
public void registerProcess(AfterTransactionCompletionProcess process)
public void registerProcess(BeforeTransactionCompletionProcess process)
public CompletionStage<Void> executeInserts()
HibernateException
- error executing queued insertion actions.public CompletionStage<Void> executeActions()
HibernateException
- error executing queued actions.public void prepareActions() throws HibernateException
HibernateException
- error preparing actions.public CompletionStage<Void> afterTransactionCompletion(boolean success)
success
- Was the transaction successful.public CompletionStage<Void> beforeTransactionCompletion()
org.hibernate.action.spi.BeforeTransactionCompletionProcess
public boolean areInsertionsOrDeletionsQueued()
true
if insertions or deletions are currently queued; false
otherwise.public boolean areTablesToBeUpdated(Set tables)
tables
- The table/query-spaces to check.true
if we contain pending actions against any of the given tables; false
otherwise.public <E extends ReactiveExecutable> CompletionStage<Void> execute(E executable)
executable
- The action to executepublic String toString()
public int numberOfCollectionRemovals()
public int numberOfCollectionUpdates()
public int numberOfCollectionCreations()
public int numberOfDeletions()
public int numberOfUpdates()
public int numberOfInsertions()
public void sortCollectionActions()
public void sortActions()
public void clearFromFlushNeededCheck(int previousCollectionRemovalSize)
public boolean hasAfterTransactionActions()
public boolean hasBeforeTransactionActions()
public boolean hasAnyQueuedActions()
public void unScheduleDeletion(EntityEntry entry, Object rescuedEntity)