childColumn.addParent(parentColumn, foreignKey); parentColumn.addChild(childColumn, foreignKey);
if (parentTable != null) { TableColumn parentColumn = parentTable.getColumn(rs.getString("PKCOLUMN_NAME"));  if (parentColumn != null) { foreignKey.addParentColumn(parentColumn);  childColumn.addParent(parentColumn, foreignKey); parentColumn.addChild(childColumn, foreignKey); } else { System.err.println("Couldn't add FK - Unknown Parent Column '" + rs.getString("PKCOLUMN_NAME") + "'"); } } else { System.err.println("Couldn't add FK - Unknown Parent Table '" + rs.getString("PKTABLE_NAME") + "'"); }
    private void addForeignKey(ResultSet rs, Map tables, DatabaseMetaData meta) throws SQLException {        String name = rs.getString("FK_NAME");        if (name == null)            return;        ForeignKeyConstraint foreignKey = getForeignKey(name);        if (foreignKey == null) {            foreignKey = new ForeignKeyConstraint(this, rs);            foreignKeys.put(foreignKey.getName().toUpperCase(), foreignKey);        }        TableColumn childColumn = getColumn(rs.getString("FKCOLUMN_NAME"));        foreignKey.addChildColumn(childColumn);        Table parentTable = (Table)tables.get(rs.getString("PKTABLE_NAME").toUpperCase());        TableColumn parentColumn = parentTable.getColumn(rs.getString("PKCOLUMN_NAME"));        foreignKey.addParentColumn(parentColumn);        childColumn.addParent(parentColumn, foreignKey);        parentColumn.addChild(childColumn, foreignKey);    }