I have two tables that I want mapped to one entity. I just need one column from the second table. The problem is the <join> element will automatically use the id from the first table, but you can specify the id from the second. The column from the first table that joins the two tables isn't the id.
Is there a way to specify another column besides the id column to use from the first table?
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="First" table="First">
<id name="Id" column="First_Id" type="int">
<generator class="assigned" />
</id>
<property name="Property1" column="Column1" />
<property name="Property2" column="Column2" />
<!--
This is the column from table First that joins
to table Second. How can I specify that I want
to use Second_Id instead of First_Id to join
the two tables together?
<property name="SecondId" column="Second_Id" />
-->
<join table="Second">
<key column="Second_Id" />
<property name="Property3" column="Column3" />
</join>
</class>
</hibernate-mapping>