You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@metamodel.apache.org by "Michael Bain (JIRA)" <ji...@apache.org> on 2015/02/16 07:30:12 UTC

[jira] [Created] (METAMODEL-111) Relationships not collating appropriately

Michael Bain created METAMODEL-111:
--------------------------------------

             Summary: Relationships not collating appropriately
                 Key: METAMODEL-111
                 URL: https://issues.apache.org/jira/browse/METAMODEL-111
             Project: Apache MetaModel
          Issue Type: Bug
    Affects Versions: 4.3.2
            Reporter: Michael Bain


The table relationships seem to ignore multi-column relations currently.  The class objects are set up to accomodate these, but looking through the code itself it appears that each column of a FK results in its own Relationship object.  Currently if I have a three-column FK constraint I end up with three objects when I list out the results of table.getRelationships(), such as:

Relationship Object 1
        Primary Table: P
        Primary Column: [a]
        Foreign Table: F
        Foreign Column: [a]

Relationship Object 2
        Primary Table: P
        Primary Column: [b]
        Foreign Table: F
        Foreign Column: [b]

Relationship Object 3
        Primary Table: P
        Primary Column: [c]
        Foreign Table: F
        Foreign Column: [c]

There is currently no way that I see to denote that these three Relationships actually comprise one complete FK.  What I would have expected would have been:

Relationship Object 1
        Primary Table: P
        Primary Column: [a, b, c]
        Foreign Table: F
        Foreign Column: [a, b, c]

I can get to this level if I look at the values returned by getImportedKeys and use the FK_NAME/PK_NAME properties.  The documentation says that these values could be null, so is there a time where you could have a multi-column FK with no name?  It looks like ORA and MSS (what I am concerned with) would auto-fill the name if one is not provided.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)