code: @Override
     public void setRollbackOnly() throws IllegalStateException, SystemException {
        Transaction tx = getTransaction();
        if (tx == null)
           throw new IllegalStateException("no transaction associated with calling thread");
        tx.setRollbackOnly();
     }
docs: Mark the transaction associated with the calling thread for rollback only.
  
  @throws IllegalStateException If the transaction is in a state where it cannot be rolled back. This could be
  because the calling thread is not associated with a transaction, or because it is in
  the {@link javax.transaction.Status#STATUS_PREPARED prepared state}.
  @throws javax.transaction.SystemException
  If the transaction service fails in an unexpected way.