public List getForeignKeysForTable(String tableName) throws SQLException
private List getForeignKeysForTable(DatabaseMetaData metaData, String tableName) throws SQLException
    public List getForeignKeysForTable(String tableName) throws SQLException    {        List      fks    = new ArrayList();        ResultSet fkData = null;        try        {            fkData = connection.getMetaData().getImportedKeys(catalog, schema, tableName);            Set        availableColumns = determineAvailableColumns(fkData);            String     prevPkTable      = null;            ForeignKey currFk           = null;            while (fkData.next())            {                String pkTable     = getValueAsString(fkData, "PKTABLE_NAME", availableColumns, null);                short  keySequence = getValueAsShort(fkData, "KEY_SEQ", availableColumns, (short)0);                // a new foreign key definition can only be identified by the changed referenced table                if (!pkTable.equals(prevPkTable) || (keySequence == 1))                {                    if (currFk != null)                    {                        fks.add(currFk);                    }                    currFk = new ForeignKey(getValueAsString(fkData, "FK_NAME", availableColumns, null));                    currFk.setForeignTableName(pkTable);                    prevPkTable = pkTable;                }                Reference ref = new Reference();                ref.setForeignColumnName(getValueAsString(fkData, "PKCOLUMN_NAME", availableColumns, null));                ref.setLocalColumnName(getValueAsString(fkData, "FKCOLUMN_NAME", availableColumns, null));                currFk.addReference(ref);            }            if (currFk != null)            {                fks.add(currFk);                currFk = null;            }        }        catch (SQLException ex)        {            log.warn("Could not determine the foreignkeys of table "+tableName, ex);        }        finally        {            if (fkData != null)            {                fkData.close();            }        }        return fks;    }