if (rel.additionalTables != null) { tables.append(',').append(rel.additionalTables); }
rel.appendAdditionalTables(tables);
    public Vector getPropertyNames(Node home, Relation rel)                            throws Exception {        // Transactor tx = (Transactor) Thread.currentThread ();        // tx.timer.beginEvent ("getNodeIDs "+home);        if ((rel == null) || (rel.otherType == null) || !rel.otherType.isRelational()) {            // this should never be called for embedded nodes            throw new RuntimeException("NodeMgr.getPropertyNames called for non-relational node " +                                       home);        } else {            Vector retval = new Vector();            // if we do a groupby query (creating an intermediate layer of groupby nodes),            // retrieve the value of that field instead of the primary key            String namefield = (rel.groupby == null) ? rel.accessName : rel.groupby;             Connection con = rel.otherType.getConnection();            // set connection to read-only mode            if (!con.isReadOnly()) con.setReadOnly(true);            String table = rel.otherType.getTableName();            Statement stmt = null;            StringBuffer tables = new StringBuffer(table);            if (rel.additionalTables != null) {                 tables.append(',').append(rel.additionalTables);            }            try {                // NOTE: we explicitly convert tables StringBuffer to a String                // before appending to be compatible with JDK 1.3                StringBuffer q = new StringBuffer("SELECT ").append(namefield)                                                            .append(" FROM ")                                                            .append(tables.toString());                if (home.getSubnodeRelation() != null) {                    q.append(" ").append(home.getSubnodeRelation());                } else {                    // let relation object build the query                    q.append(rel.buildQuery(home,                                            home.getNonVirtualParent(),                                            null,                                            " WHERE ",                                            true));                }                stmt = con.createStatement();                long logTimeStart = logSql ? System.currentTimeMillis() : 0;                ResultSet rs = stmt.executeQuery(q.toString());                if (logSql) {                    long logTimeStop = System.currentTimeMillis();                    logSqlStatement("SQL SELECT_ACCESSNAMES", table,                                    logTimeStart, logTimeStop, q.toString());                }                while (rs.next()) {                    String n = rs.getString(1);                    if (n != null) {                        retval.addElement(n);                    }                }            } finally {                // tx.timer.endEvent ("getNodeIDs "+home);                if (stmt != null) {                    try {                        stmt.close();                    } catch (Exception ignore) {                    }                }            }            return retval;        }    }