Package org.hibernate.reactive.engine
Class ReactiveActionQueue
java.lang.Object
org.hibernate.reactive.engine.ReactiveActionQueue
A reactive counterpart to
ActionQueue
, where DML
operations are queued before execution during a flush.-
Constructor Summary
ConstructorsConstructorDescriptionReactiveActionQueue
(ReactiveSession session) Constructs an action queue bound to the given session. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Adds an action relating to a collection queued operation (extra lazy).void
Adds a collection (re)create actionvoid
Adds a collection remove actionvoid
Adds a collection update actionvoid
addAction
(ReactiveEntityDeleteAction action) Adds an entity delete actionaddAction
(ReactiveEntityInsertAction action) Adds an entity (REGULAR) insert actionvoid
addAction
(ReactiveEntityUpdateAction action) Adds an entity update actionvoid
addAction
(ReactiveOrphanRemovalAction action) Adds an orphan removal actionafterTransactionCompletion
(boolean success) Performs cleanup of any held cache softlocks.boolean
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.Execute any registeredBeforeTransactionCompletionProcess
void
ThrowsPropertyValueException
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>
CompletionStage<Void>execute
(E executable) Perform all currently queued actions.Perform all currently queued entity-insertion actions.boolean
boolean
boolean
boolean
Are there unresolved entity insert actions that depend on non-nullable associations with a transient entity?int
int
int
int
int
int
void
Prepares the internal action queues for execution.void
registerProcess
(org.hibernate.action.spi.AfterTransactionCompletionProcess process) void
registerProcess
(org.hibernate.action.spi.BeforeTransactionCompletionProcess process) void
void
void
void
toString()
Returns a string representation of the object.void
unScheduleDeletion
(org.hibernate.engine.spi.EntityEntry entry, Object rescuedEntity)
-
Constructor Details
-
ReactiveActionQueue
Constructs an action queue bound to the given session.- Parameters:
session
- The session "owning" this queue.
-
-
Method Details
-
clear
public void clear() -
addAction
Adds an entity (REGULAR) insert action- Parameters:
action
- The action representing the entity insertion
-
addAction
Adds an entity delete action- Parameters:
action
- The action representing the entity deletion
-
addAction
Adds an orphan removal action- Parameters:
action
- The action representing the orphan removal
-
addAction
Adds an entity update action- Parameters:
action
- The action representing the entity update
-
addAction
Adds a collection (re)create action- Parameters:
action
- The action representing the (re)creation of a collection
-
addAction
Adds a collection remove action- Parameters:
action
- The action representing the removal of a collection
-
addAction
Adds a collection update action- Parameters:
action
- The action representing the update of a collection
-
addAction
Adds an action relating to a collection queued operation (extra lazy).- Parameters:
action
- The action representing the queued operation
-
addAction
public 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)- Parameters:
action
- The action representing the queued operation
-
hasUnresolvedEntityInsertActions
public boolean hasUnresolvedEntityInsertActions()Are there unresolved entity insert actions that depend on non-nullable associations with a transient entity?- Returns:
- true, if there are unresolved entity insert actions that depend on non-nullable associations with a transient entity; false, otherwise
-
checkNoUnresolvedActionsAfterOperation
public void checkNoUnresolvedActionsAfterOperation() throws org.hibernate.PropertyValueExceptionThrowsPropertyValueException
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.- Throws:
org.hibernate.PropertyValueException
- if there are any unresolved entity insert actions;PropertyValueException.getEntityName()
andPropertyValueException.getPropertyName()
will return the entity name and property value for the first unresolved entity insert action.
-
registerProcess
public void registerProcess(org.hibernate.action.spi.AfterTransactionCompletionProcess process) -
registerProcess
public void registerProcess(org.hibernate.action.spi.BeforeTransactionCompletionProcess process) -
registerProcess
-
registerProcess
-
executeInserts
Perform all currently queued entity-insertion actions.- Throws:
org.hibernate.HibernateException
- error executing queued insertion actions.
-
executeActions
Perform all currently queued actions.- Throws:
org.hibernate.HibernateException
- error executing queued actions.
-
prepareActions
public void prepareActions() throws org.hibernate.HibernateExceptionPrepares the internal action queues for execution.- Throws:
org.hibernate.HibernateException
- error preparing actions.
-
afterTransactionCompletion
Performs cleanup of any held cache softlocks.- Parameters:
success
- Was the transaction successful.
-
beforeTransactionCompletion
Execute any registeredBeforeTransactionCompletionProcess
-
areInsertionsOrDeletionsQueued
public boolean areInsertionsOrDeletionsQueued()Check whether any insertion or deletion actions are currently queued.- Returns:
true
if insertions or deletions are currently queued;false
otherwise.
-
areTablesToBeUpdated
Check whether the given tables/query-spaces are to be executed against given the currently queued actions.- Parameters:
tables
- The table/query-spaces to check.- Returns:
true
if we contain pending actions against any of the given tables;false
otherwise.
-
execute
- Parameters:
executable
- The action to execute
-
toString
Returns a string representation of the object. -
numberOfCollectionRemovals
public int numberOfCollectionRemovals() -
numberOfCollectionUpdates
public int numberOfCollectionUpdates() -
numberOfCollectionCreations
public int numberOfCollectionCreations() -
numberOfDeletions
public int numberOfDeletions() -
numberOfUpdates
public int numberOfUpdates() -
numberOfInsertions
public int numberOfInsertions() -
sortCollectionActions
public void sortCollectionActions() -
sortActions
public void sortActions() -
clearFromFlushNeededCheck
public void clearFromFlushNeededCheck(int previousCollectionRemovalSize) -
hasAfterTransactionActions
public boolean hasAfterTransactionActions() -
hasBeforeTransactionActions
public boolean hasBeforeTransactionActions() -
hasAnyQueuedActions
public boolean hasAnyQueuedActions() -
unScheduleDeletion
-