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(org.hibernate.action.internal.BulkOperationCleanupAction action)
Adds an action defining a cleanup relating to a bulk operation (HQL/JPQL or Criteria based update/delete)
|
void |
addAction(org.hibernate.action.internal.QueuedOperationCollectionAction action)
Adds an action relating to a collection queued operation (extra lazy).
|
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionRecreateAction action)
Adds a collection (re)create action
|
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionRemoveAction action)
Adds a collection remove action
|
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionUpdateAction action)
Adds a collection update action
|
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveEntityDeleteAction action)
Adds an entity delete action
|
CompletionStage<Void> |
addAction(org.hibernate.reactive.engine.impl.ReactiveEntityIdentityInsertAction action)
Adds an entity (IDENTITY) insert action
|
CompletionStage<Void> |
addAction(org.hibernate.reactive.engine.impl.ReactiveEntityRegularInsertAction action) |
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveEntityUpdateAction action)
Adds an entity update action
|
void |
addAction(org.hibernate.reactive.engine.impl.ReactiveOrphanRemovalAction action)
Adds an orphan removal 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
BeforeTransactionCompletionProcess |
void |
checkNoUnresolvedActionsAfterOperation()
Throws
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(org.hibernate.action.spi.AfterTransactionCompletionProcess process) |
void |
registerProcess(org.hibernate.action.spi.BeforeTransactionCompletionProcess process) |
void |
registerProcess(ReactiveAfterTransactionCompletionProcess process) |
void |
registerProcess(ReactiveBeforeTransactionCompletionProcess process) |
void |
sortActions() |
void |
sortCollectionActions() |
String |
toString()
Returns a string representation of the object.
|
void |
unScheduleDeletion(org.hibernate.engine.spi.EntityEntry entry,
Object rescuedEntity) |
public ReactiveActionQueue(ReactiveSession session)
session
- The session "owning" this queue.public void clear()
public CompletionStage<Void> addAction(org.hibernate.reactive.engine.impl.ReactiveEntityRegularInsertAction action)
public CompletionStage<Void> addAction(org.hibernate.reactive.engine.impl.ReactiveEntityIdentityInsertAction action)
action
- The action representing the entity insertionpublic void addAction(org.hibernate.reactive.engine.impl.ReactiveEntityDeleteAction action)
action
- The action representing the entity deletionpublic void addAction(org.hibernate.reactive.engine.impl.ReactiveOrphanRemovalAction action)
action
- The action representing the orphan removalpublic void addAction(org.hibernate.reactive.engine.impl.ReactiveEntityUpdateAction action)
action
- The action representing the entity updatepublic void addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionRecreateAction action)
action
- The action representing the (re)creation of a collectionpublic void addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionRemoveAction action)
action
- The action representing the removal of a collectionpublic void addAction(org.hibernate.reactive.engine.impl.ReactiveCollectionUpdateAction action)
action
- The action representing the update of a collectionpublic void addAction(org.hibernate.action.internal.QueuedOperationCollectionAction action)
action
- The action representing the queued operationpublic void addAction(org.hibernate.action.internal.BulkOperationCleanupAction action)
action
- The action representing the queued operationpublic boolean hasUnresolvedEntityInsertActions()
public void checkNoUnresolvedActionsAfterOperation() throws org.hibernate.PropertyValueException
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;
PropertyValueException.getEntityName()
and
PropertyValueException.getPropertyName()
will return the entity name and property value for
the first unresolved entity insert action.public void registerProcess(org.hibernate.action.spi.AfterTransactionCompletionProcess process)
public void registerProcess(org.hibernate.action.spi.BeforeTransactionCompletionProcess process)
public void registerProcess(ReactiveAfterTransactionCompletionProcess process)
public void registerProcess(ReactiveBeforeTransactionCompletionProcess process)
public CompletionStage<Void> executeInserts()
org.hibernate.HibernateException
- error executing queued insertion actions.public CompletionStage<Void> executeActions()
org.hibernate.HibernateException
- error executing queued actions.public void prepareActions() throws org.hibernate.HibernateException
org.hibernate.HibernateException
- error preparing actions.public CompletionStage<Void> afterTransactionCompletion(boolean success)
success
- Was the transaction successful.public CompletionStage<Void> beforeTransactionCompletion()
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(org.hibernate.engine.spi.EntityEntry entry, Object rescuedEntity)
Copyright © 2020-2022 Red Hat, Inc. All Rights Reserved.