public void withTransaction(String name, boolean readOnly, Consumer<EntityManager> block) {
    """
	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
    """
    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 .