Пример #1
0
 /**
  * Run a block of code in a JPA transaction.
  *
  * @param block Block of code to execute
  */
 public void withTransaction(final Runnable block) {
   try {
     withTransaction(
         "default",
         false,
         () -> {
           block.run();
           return null;
         });
   } catch (Throwable t) {
     throw new RuntimeException("JPA transaction failed", t);
   }
 }
Пример #2
0
 /**
  * executes the runnable under only one transaction. Usefull to do various action overt the
  * application in one transaction
  *
  * @param runnable
  */
 public void execute(final Runnable runnable) {
   runnable.run();
 }