A couple of things I have come across while working on a side project:

1)      The table relationships seem to ignore multi-column relations 
currently.  The data is set up to accept it, but looking through the code 
itself it appears that each column of a FK results in its own Relationship 
object.  I am working around it currently based on  the code in MetaModel, but 
I wanted to see if I was missing something in the existing code.  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.


2)      Having to load the entire schema's relationships to get to one table's 
relationships is REALLY expensive in my case.   Does it not make sense to have 
table.getRelationships() only worry about its own and then store the 
information as it is loaded at that level?

Looking at the code the pieces are there to essentially do both of these, so I 
am wondering if I am just missing something or if these are features planned 
for further down the road?

Thanks...

Mike

Reply via email to