Example #1
0
 public void create(TagBean newTagBean) throws RollbackException {
   try {
     Transaction.begin();
     createAutoIncrement(newTagBean);
     Transaction.commit();
   } finally {
     if (Transaction.isActive()) Transaction.rollback();
   }
 }
Example #2
0
  public void delete(int id, int rid) throws RollbackException {
    try {
      Transaction.begin();
      TagBean item = read(id);

      if (item == null) {
        throw new RollbackException("Step does not exist: id=" + id);
      }

      if (rid != item.getRid()) {
        throw new RollbackException("Step not owned by recipe id:" + rid);
      }

      delete(id);
      Transaction.commit();
    } finally {
      if (Transaction.isActive()) Transaction.rollback();
    }
  }