NHibernate - mappping composite-id to table with non-composite primary key

Posted by Dmitry on Stack Overflow See other posts from Stack Overflow or by Dmitry
Published on 2010-06-02T11:34:17Z Indexed on 2010/06/02 11:44 UTC
Read the original article Hit count: 385

Filed under:
|

I have table like this:

ID - PK; KEY1 - UNIQUE1; KEY2 - UNIQUE1;

If I don't want to use ID in my mappings, can I tell NHibernate to use KEY1 & KEY2 as a composite id? When I declare composite id like this:

<composite-id>
  <key-property name="KEY1"/>
  <key-property name="KEY2"/>
</composite-id>

I get FKUnmatchingColumnsException (Foreign key ... must have same number of columns as the referenced primary key ...)

© Stack Overflow or respective owner

Related posts about .NET

Related posts about nhibernate