コード例 #1
0
  /** Creates a new subject */
  public EntityBean create(EntityBean eb) {
    SubjectGroupMapBean sb = (SubjectGroupMapBean) eb;
    HashMap variables = new HashMap();
    // INSERT INTO SUBJECT_GROUP_MAP (study_group_class_id,
    // study_subject_id, study_group_id,
    // status_id, owner_id,date_created,
    // notes) VALUES (?,?,?,?,?,NOW(),?)
    variables.put(new Integer(1), new Integer(sb.getStudyGroupClassId()));
    variables.put(new Integer(2), new Integer(sb.getStudySubjectId()));
    variables.put(new Integer(3), new Integer(sb.getStudyGroupId()));
    variables.put(new Integer(4), new Integer(sb.getStatus().getId()));
    variables.put(new Integer(5), new Integer(sb.getOwner().getId()));
    variables.put(new Integer(6), sb.getNotes());
    // DATE_CREATED is now()

    this.execute(digester.getQuery("create"), variables);

    return sb;
  }
コード例 #2
0
  /**
   * <b>update </b>, the method that returns an updated subject bean after it updates the database.
   *
   * @return sb, an updated study bean.
   */
  public EntityBean update(EntityBean eb) {
    SubjectGroupMapBean sb = (SubjectGroupMapBean) eb;
    HashMap variables = new HashMap();
    // UPDATE SUBJECT_GROUP_MAP SET STUDY_GROUP_CLASS_ID=?,
    // STUDY_SUBJECT_ID=?,STUDY_GROUP_ID=?,
    // STATUS_ID=?,DATE_UPDATED=?, UPDATE_ID=? , notes = ?
    // WHERE SUBJECT_GROUP_MAP_ID=?
    variables.put(new Integer(1), new Integer(sb.getStudyGroupClassId()));
    variables.put(new Integer(2), new Integer(sb.getStudySubjectId()));
    variables.put(new Integer(3), new Integer(sb.getStudyGroupId()));
    variables.put(new Integer(4), new Integer(sb.getStatus().getId()));

    variables.put(new Integer(5), new java.util.Date());
    variables.put(new Integer(6), new Integer(sb.getUpdater().getId()));
    variables.put(new Integer(8), new Integer(sb.getId()));
    variables.put(new Integer(7), sb.getNotes());

    String sql = digester.getQuery("update");
    this.execute(sql, variables);

    return sb;
  }