Class EntityManagerExecutor

java.lang.Object
org.axonframework.common.jpa.EntityManagerExecutor
All Implemented Interfaces:
TransactionalExecutor<jakarta.persistence.EntityManager>

@Internal public class EntityManagerExecutor extends Object implements TransactionalExecutor<jakarta.persistence.EntityManager>
A TransactionalExecutor implementation for EntityManagers.
Since:
5.0.2
Author:
John Hendrikx
  • Constructor Details

  • Method Details

    • apply

      public <R> CompletableFuture<R> apply(@Nonnull ThrowingFunction<jakarta.persistence.EntityManager,R,Exception> function)
      Description copied from interface: TransactionalExecutor
      Executes a transactional operation that returns a result.

      Implementations are responsible for managing the lifecycle of the provided resource, including obtaining, closing, commit and rollback.

      Specified by:
      apply in interface TransactionalExecutor<jakarta.persistence.EntityManager>
      Type Parameters:
      R - The type of the result returned by the function.
      Parameters:
      function - A function that accepts the transactional resource of type T and produces a result of type R; cannot be null.
      Returns:
      A CompletableFuture which when it completes contains the result of the provided function, never null.