Interface ActionQueue

All Superinterfaces:
TransactionCompletionCallbacks
All Known Implementing Classes:
ActionQueueLegacy

@Incubating public interface ActionQueue extends TransactionCompletionCallbacks

Common interface for ActionQueue implementations.

The ActionQueue is responsible for managing and executing all pending persistence actions (inserts, updates, deletes, etc.) in a Hibernate session. Different implementations may use different execution strategies.

Since:
8.0
  • Method Details

    • clear

      void clear()
      Clear all pending actions.
    • addAction

      void addAction(org.hibernate.action.internal.EntityInsertAction action)
      Adds an entity insert action.
      Parameters:
      action - The action representing the entity insertion
    • addAction

      void addAction(org.hibernate.action.internal.EntityIdentityInsertAction action)
      Adds an identity-based entity insert action.
      Parameters:
      action - The action representing the entity insertion with identity generation
    • addAction

      void addAction(org.hibernate.action.internal.EntityUpdateAction action)
      Adds an entity update action.
      Parameters:
      action - The action representing the entity update
    • addAction

      void addAction(org.hibernate.action.internal.EntityDeleteAction action)
      Adds an entity delete action.
      Parameters:
      action - The action representing the entity deletion
    • addAction

      void addAction(org.hibernate.action.internal.OrphanRemovalAction action)
      Adds an orphan removal action.
      Parameters:
      action - The action representing orphan removal
    • addAction

      void addAction(org.hibernate.action.internal.CollectionRecreateAction action)
      Adds a collection recreation action.
      Parameters:
      action - The action representing the collection recreation
    • addAction

      void addAction(org.hibernate.action.internal.CollectionRemoveAction action)
      Adds a collection removal action.
      Parameters:
      action - The action representing the collection removal
    • addAction

      void addAction(org.hibernate.action.internal.CollectionUpdateAction action)
      Adds a collection update action.
      Parameters:
      action - The action representing the collection update
    • addAction

      void addAction(org.hibernate.action.internal.QueuedOperationCollectionAction action)
      Adds a queued operation collection action.
      Parameters:
      action - The action representing the queued collection operation
    • addAction

      void addAction(org.hibernate.action.internal.BulkOperationCleanupAction action)
      Adds a bulk operation cleanup action.
      Parameters:
      action - The action representing bulk operation cleanup
    • executeInserts

      void executeInserts() throws HibernateException
      Execute identity insert actions.
      Throws:
      HibernateException - If an error occurs during execution
    • executeActions

      void executeActions() throws HibernateException
      Execute all pending actions.
      Throws:
      HibernateException - If an error occurs during execution
    • prepareActions

      void prepareActions() throws HibernateException
      Prepare actions for execution (validation, sorting, etc.).
      Throws:
      HibernateException - If an error occurs during preparation
    • executePendingBulkOperationCleanUpActions

      void executePendingBulkOperationCleanUpActions()
      Execute pending bulk operation cleanup actions.
    • hasUnresolvedEntityInsertActions

      boolean hasUnresolvedEntityInsertActions()
      Check if there are unresolved entity insert actions.
      Returns:
      true if there are unresolved entity insert actions
    • hasAnyQueuedActions

      boolean hasAnyQueuedActions()
      Check if there are any queued actions.
      Returns:
      true if there are any queued actions
    • hasBeforeTransactionActions

      boolean hasBeforeTransactionActions()
      Check if there are before-transaction actions.
      Returns:
      true if there are before-transaction actions
    • hasAfterTransactionActions

      boolean hasAfterTransactionActions()
      Check if there are after-transaction actions.
      Returns:
      true if there are after-transaction actions
    • areInsertionsOrDeletionsQueued

      boolean areInsertionsOrDeletionsQueued()
      Check if there are insertions or deletions queued.
      Returns:
      true if there are insertions or deletions queued
    • areTablesToBeUpdated

      boolean areTablesToBeUpdated(Set<? extends Serializable> tables)
      Check if any of the specified tables are scheduled for update.
      Parameters:
      tables - The set of table names to check
      Returns:
      true if any of the tables are scheduled for update
    • checkNoUnresolvedActionsAfterOperation

      void checkNoUnresolvedActionsAfterOperation() throws PropertyValueException
      Check that there are no unresolved actions after an operation.
      Throws:
      PropertyValueException - If there are unresolved actions
    • numberOfInsertions

      int numberOfInsertions()
      Get the number of insertions.
      Returns:
      The number of insertions
    • numberOfUpdates

      int numberOfUpdates()
      Get the number of updates.
      Returns:
      The number of updates
    • numberOfDeletions

      int numberOfDeletions()
      Get the number of deletions.
      Returns:
      The number of deletions
    • numberOfCollectionCreations

      int numberOfCollectionCreations()
      Get the number of collection creations.
      Returns:
      The number of collection creations
    • numberOfCollectionUpdates

      int numberOfCollectionUpdates()
      Get the number of collection updates.
      Returns:
      The number of collection updates
    • numberOfCollectionRemovals

      int numberOfCollectionRemovals()
      Get the number of collection removals.
      Returns:
      The number of collection removals
    • getTransactionCompletionCallbacks

      TransactionCompletionCallbacksImplementor getTransactionCompletionCallbacks()
      Get the transaction completion callbacks.
      Returns:
      The transaction completion callbacks implementor
    • setTransactionCompletionCallbacks

      @Deprecated(since="7.0", forRemoval=true) void setTransactionCompletionCallbacks(TransactionCompletionCallbacksImplementor callbacks, boolean isTransactionCoordinatorShared)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is not used by GraphBasedActionQueue and is only needed for ActionQueueLegacy. It will be removed when the legacy implementation is removed.
      Set the transaction completion callbacks.
      Parameters:
      callbacks - The transaction completion callbacks
      isTransactionCoordinatorShared - Whether the transaction coordinator is shared
    • beforeTransactionCompletion

      void beforeTransactionCompletion()
      Execute actions before transaction completion.
    • setAuditChangesetContext

      void setAuditChangesetContext(Object changelog, Session changesetSession)
      Record the changelog context generated while binding legacy audit mutations.
      Parameters:
      changelog - The changelog entity instance
      changesetSession - The child session used to persist the changelog entity
      API Note:
      This hook exists for ActionQueueLegacy, whose audit work queue receives changelog context as a side effect of resolving the current changeset id. The graph queue resolves changelog context directly from the session and ignores this callback.
    • afterTransactionCompletion

      void afterTransactionCompletion(boolean success)
      Execute actions after transaction completion.
      Parameters:
      success - Whether the transaction completed successfully
    • sortActions

      @Deprecated(since="7.0", forRemoval=true) default void sortActions()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is not used by GraphBasedActionQueue and is only needed for ActionQueueLegacy. It will be removed when the legacy implementation is removed.
      Sort entity actions if ordering is enabled.
    • sortCollectionActions

      @Deprecated(since="7.0", forRemoval=true) default void sortCollectionActions()
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method is not used by GraphBasedActionQueue and is only needed for ActionQueueLegacy. It will be removed when the legacy implementation is removed.
      Sort collection actions if ordering is enabled.
    • unScheduleUnloadedDeletion

      void unScheduleUnloadedDeletion(Object newEntity)
      Un-schedule a deletion for an unloaded entity.
      Parameters:
      newEntity - The entity being persisted
    • unScheduleDeletion

      void unScheduleDeletion(EntityEntry entry, Object rescuedEntity)
      Un-schedule a deletion for an entity.
      Parameters:
      entry - The entity entry
      rescuedEntity - The entity being rescued from deletion
    • clearFromFlushNeededCheck

      void clearFromFlushNeededCheck(int previousCollectionRemovalSize)
      Clear actions that were added during a flush needed check.
      Parameters:
      previousCollectionRemovalSize - The previous collection removal size
    • serialize

      void serialize(ObjectOutputStream oos) throws IOException
      Serialize the action queue.
      Parameters:
      oos - The object output stream
      Throws:
      IOException - If an I/O error occurs
      See Also: