I have a legacy table with composite keys that are mapped to 3 other tables, since this table have other attributes in it, since it is not a simple mapping table, I can't use the many-to-many set solution to map this.
The following is what I have done:
<class name="classA" table="A">
<composite-id name="ID" class="AKey">
<key-many-to-one name="Id_one" class="One" column="Id_one" />
<key-many-to-one name="Id_two" class="Two" column="Id_two" />
<key-many-to-one name="Id_three" class="Three" column="Id_three" />
</composite-id>
AKey is merely a struct that holds the three ids, and Id_one, Id_two, and Id_three are all defined as int in their respective class.
public struct Akey {
public int Id_one { get; set; }
public int Id_two { get; set; }
public int Id_three { get; set; }
}
This compiles fine, but when I try to run it, it gives me an error message:
NHibernate.QueryException : Type mismatch in NHibernate.Criterion.SimpleExpression: ID expected type AKey, actual type System.Int32
Please advise on what I have done wrong or missed.
Thanks a bunch!