Hi Mike, Thank you for the email. I quite agree to your concerns.
1) Seems that the relationship-loading might simply be faulty in not correlating different records from the getImportedKeys resultset? Anyways I think it's a issue worthwhile reporting on JIRA and if you want to help fixing it, that would be awesome. 2) How many relationships do you have? I remember thinking about this at the time of building it initially and concluding (maybe naively) that there would be a maximum of a few hundred relationships and thus doing a single pass to the database would be far more effecient than having to do N passes. But of course if the database is really slow to respond to it, then it could be a problem. I just feel that delivering a few hundred records would be a pretty quick thing to do? On a related note, I do think having a filter on which schemas (and maybe even which tables) should be included would be nice. I have seen a few examples where metamodel's schema model of a large DB ends up being thousands of objects because it loads tons of irrelevant schemas into memory. But that's something else, just felt it was slightly related. Best regards, Kasper 2015-02-06 23:35 GMT+01:00 Bain, Michael <[email protected]>: > 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 >
