code: public void runInRetryableTransaction(Runnable runnable)
      throws DataAccessException {
          TransactionWrapper transaction=null;
          try {
              transaction = startTransaction();
              runnable.run();
          } catch (Throwable e) {
              if (canRetryTransaction(e)) {
                  transaction = (TransactionWrapper)initTransactionRetry(transaction);
                  ((ProcessExecutor)getTransactionRetrier()).runInTransaction(runnable);
              }
              else
                  throw e;
          } finally {
              stopTransaction(transaction);
          }
      }
docs: For running your own code inside a retryable transaction.
  To be used in execute() method when transactions are not turned on globally.
  @param runnable
  @throws ProcessException
  @throws DataAccessException