persistence/play-java-jpa/src/main/java/play/db/jpa/DefaultJPAApi.java
public void withTransaction(Consumer<EntityManager> block) {
    withTransaction(
        em -> {
          block.accept(em);
          return null;
        });
  }
public void withTransaction(Consumer<EntityManager> block) {
    withTransaction(
        em -> {
          block.accept(em);
          return null;
        });
  }
Run a block of code with a newly created EntityManager for the default Persistence Unit.

@param block Block of code to execute