documentation/manual/working/javaGuide/main/sql/code/JPARepository.java
public CompletionStage<Void> runningWithRunnable() {
    // lambda is an instance of Consumer<EntityManager>
    return CompletableFuture.runAsync(
        () -> {
          jpaApi.withTransaction(
              entityManager -> {
                Query query =
                    entityManager.createNativeQuery("update people set active = 1 where age > 18");
                query.executeUpdate();
              });
        },
        executionContext);
  }
public CompletionStage<Void> runningWithRunnable() {
    // lambda is an instance of Consumer<EntityManager>
    return CompletableFuture.runAsync(
        () -> {
          jpaApi.withTransaction(
              entityManager -> {
                Query query =
                    entityManager.createNativeQuery("update people set active = 1 where age > 18");
                query.executeUpdate();
              });
        },
        executionContext);
  }
#jpa-withTransaction-consumer