public <T> T withTransaction(String name, Function<EntityManager, T> block) {
    return withTransaction(name, false, block);
  }
public <T> T withTransaction(String name, Function<EntityManager, T> block) {
    return withTransaction(name, false, block);
  }
public < T > T withTransaction ( String name , Function < EntityManager , T > block ) { return withTransaction ( name , false , block ) ; }
Run a block of code with a newly created EntityManager for the named Persistence Unit.

@param name The persistence unit name
@param block Block of code to execute
@param <T> type of result
@return code execution result
Run a block of code with a newly created EntityManager for the named Persistence Unit .