NHibernate and Composite Key References

Posted by Rich on Stack Overflow See other posts from Stack Overflow or by Rich
Published on 2010-05-18T19:39:35Z Indexed on 2010/05/18 19:40 UTC
Read the original article Hit count: 234

Filed under:

I have a weird situation. I have three entities, Company, Employee, Plan and Participation (in retirement plan).

Company PK: Company ID Plan PK: Company ID, Plan ID Employee PK: Company ID, SSN, Employee ID Participation PK: Company ID, SSN, Plan ID

The problem is in linking the employee to the participation. From a DB perspective, participation should have Employee ID in the PK (it's not even in table). But it doesn't. NHibernate won't let me map the "has many" because the link expects 3 columns (since Employee PK has 3 columns), but I'd only provide 2.

Any ideas on how to do this?

© Stack Overflow or respective owner

Related posts about nhibernate