예제 #1
0
파일: TagDAO.java 프로젝트: shijieru/Recipe
 public void create(TagBean newTagBean) throws RollbackException {
   try {
     Transaction.begin();
     createAutoIncrement(newTagBean);
     Transaction.commit();
   } finally {
     if (Transaction.isActive()) Transaction.rollback();
   }
 }
예제 #2
0
파일: TagDAO.java 프로젝트: shijieru/Recipe
  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();
    }
  }