Пример #1
0
 @Override
 public <V> V runInTransaction(Callable<V> callable, @Nullable TransactionIsolation isolation) {
   Objects.requireNotNull(callable);
   checkClosed();
   Transaction transaction = transactionProvider.get();
   if (transaction == null) {
     throw new TransactionException("no transaction");
   }
   try {
     transaction.begin(isolation);
     V result = callable.call();
     transaction.commit();
     return result;
   } catch (Exception e) {
     throw new RollbackException(e);
   }
 }
Пример #2
0
 @Override
 public Transaction transaction() {
   checkClosed();
   return transactionProvider.get();
 }