if (rel != null && rel.additionalTables != null) { s.append(',').append(rel.additionalTables); }
    public StringBuffer getSelect(Relation rel) throws SQLException, ClassNotFoundException {        // assign to local variable first so we are thread safe        // (selectString may be reset by other threads)        String sel = selectString;        if (rel == null && sel != null) {            return new StringBuffer(sel);        }        StringBuffer s = new StringBuffer("SELECT ");        if (rel != null && rel.queryHints != null) {            s.append(rel.queryHints).append(" ");        }        String table = getTableName();        // all columns from the main table        s.append(table);        s.append(".*");        if (rel != null && rel.additionalTables != null) {            s.append(',').append(rel.additionalTables);        }        for (int i = 0; i < joins.length; i++) {            if (!joins[i].otherType.isRelational()) {                continue;            }            s.append(", ");            s.append(Relation.JOIN_PREFIX);            s.append(joins[i].propName);            s.append(".*");        }        s.append(" FROM ");        s.append(table);        s.append(" ");        for (int i = 0; i < joins.length; i++) {            if (!joins[i].otherType.isRelational()) {                continue;            }            s.append("LEFT OUTER JOIN ");            s.append(joins[i].otherType.getTableName());            s.append(" AS ");            s.append(Relation.JOIN_PREFIX);            s.append(joins[i].propName);            s.append(" ON ");            joins[i].renderJoinConstraints(s);        }        // cache rendered string for later calls, but only if it wasn't        // built for a particular Relation        if (rel == null) {            selectString = s.toString();        }        return s;    }