I am trying to load columns from a second table in the database as properties on a model using NHibernate. I'm using an XML mapping file and tried using the join tag. When I build and try to run the code, I get the following error:
The element 'join' in namespace 'urn:nhibernate-mapping-2.2' has invalid child element 'key' in namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected: 'property, many-to-one, component, dynamic-component, any, map, set, list, bag, idbag, array, primitive-array, sql-insert, sql-update, sql-delete' in namespace 'urn:nhibernate-mapping-2.2'.
The following is a snippet of the mapping file:
<class name="Article" table="article">
<id name="Id" column="articleID" unsaved-value="-1" type="Int32">
<generator class="identity" />
</id>
<property name="ClientId" column="accountID" type="Int32" />
<property name="PublicNumber" column="articleNum" />
<join table="articleLanguage">
<key column="accountID" />
<key column="articleNum" />
<property name="Question" />
<property name="LanguageId"/>
</join>
</class>
What am I doing wrong?