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

@param name The persistence unit name
@param readOnly Is the transaction read-only?
@param block Block of code to execute
Run a block of code with a newly created EntityManager for the named Persistence Unit .