I am stuck with a legacy database involving composite keys and there is no room to modify the db.
The problem seems to be that one part of the key is also used for each foreign key. So if I have tables A and B like this:
A
- company (PK)
- aId (PK)
- someMoreInfo
B
- company (PK, FK)
- bId (PK)
- aId (FK)
- someOtherInfo
The company field in table B is PK for table B and used for ther FK to table A. All the things I tried lead me to Repeated column in mapping
exceptions.
So this is not a 'how do I' question (well, if you have a solution - go ahead I'd consider myself lucky if this is just my imagination and there is no real problem…) but a 'do you feel this is right' question.
- could it be possible to acces a db like this using nhibernate (well, apart from mapping all tables 1:1 without references)
- do you feel it is a good idea?
- what are the alternatives given my circumstances (i.e. Are any O/R-Mappers good at this)?
BTW: This is the same problem, and one of my complex scenarios is here.