code: private static void getForeignKeys(DatabaseMetaData md, DatabaseRelationDefinition relation, DBMetadata metadata) throws SQLException {
  
  		QuotedIDFactory idfac = metadata.getQuotedIDFactory();
  
  		RelationID relationId = relation.getID();
  		try (ResultSet rs = md.getImportedKeys(null, relationId.getSchemaName(), relationId.getTableName())) {
              extractForeignKeys(relation, metadata, idfac, rs);
          }
          catch (Exception ex) {
              try (ResultSet rs = md.getImportedKeys(relationId.getSchemaName(),null, relationId.getTableName())) {
                  extractForeignKeys(relation, metadata, idfac, rs);
              }
          }
  	}
docs: Retrieves the foreign keys for the table