Posting code and XML snippets may make this question harder than it is, so I'll refrain from doing that.
Many of the tables in our database have compound primary and foreign keys. And quite often, the primary key contains a foreign key back to another table. This is all fine until the primary key actually contains two foreign keys back to two different tables, and one of the components of the compound key is shared between the two FKs...
Clear as mud?
Picture three tables:
TABLE1 has a PK, column A
TABLE2 has a PK, column A and Column B. Column A is a FK back to TABLE1
TABLE3 has a PK, column A, Column B, and Column C. Column A is a FK back to TABLE1, and columns A,B are a FK back to TABLE2
So, I was able to map TABLE3 by using a key-many-to-one relationship to TABLE2, and a many-to-one relationship to TABLE1. Is this the correct mapping, even though column A is actually part of the PK of TABLE3 and should really be mapped as a key-many-to-one? If I map it as a key-many-to-one I get a duplicate mapping exception (which makes sense).
Thanks!
--Mark J
|