コード例 #1
0
 public Collection ejbFindByComplex(Integer complexID) throws FinderException {
   Table category = new Table(this, "c");
   Table type = new Table(ApartmentType.class, "t");
   Table apartment = new Table(Apartment.class, "a");
   Table floor = new Table(Floor.class, "f");
   Table building = new Table(Building.class, "b");
   SelectQuery query = new SelectQuery(category);
   query.setAsDistinct(true);
   query.addColumn(new WildCardColumn(category));
   try {
     query.addJoin(type, category);
     query.addJoin(apartment, type);
     query.addJoin(apartment, floor);
     query.addJoin(floor, building);
   } catch (IDORelationshipException e) {
     throw new FinderException(e.getMessage());
   }
   query.addCriteria(
       new MatchCriteria(
           new Column(building, BuildingBMPBean.BU_COMPLEX_ID),
           MatchCriteria.EQUALS,
           complexID.intValue()));
   query.addOrder(category, this.getIDColumnName(), true);
   return idoFindPKsBySQL(query.toString());
 }
コード例 #2
0
  Collection<Object> ejbFindAllCommentsByHolder(String commentHolder) throws FinderException {
    Table table = new Table(this);
    SelectQuery query = new SelectQuery(table);
    query.addColumn(new Column(table, getIDColumnName()));

    query.addCriteria(
        new MatchCriteria(
            new Column(table, COLUMN_COMMENT_HOLDER), MatchCriteria.EQUALS, commentHolder));
    addNotDeletedCriteria(query, table);

    return this.idoFindPKsByQuery(query);
  }
コード例 #3
0
 private void addNotDeletedCriteria(SelectQuery query, Table table) {
   Criteria isNull =
       new MatchCriteria(new Column(table, COLUMN_DELETED), MatchCriteria.IS, MatchCriteria.NULL);
   Criteria isFalse =
       new MatchCriteria(new Column(table, COLUMN_DELETED), MatchCriteria.EQUALS, false);
   query.addCriteria(new OR(isNull, isFalse));
 }