If you look at the following database diagram, you will see that there are two relationships that need to be mapped, BillToContact
and ShipToContact
(represented by BillToContact_Id and ShipToContact_Id in the following screenshot).
Let's map these two properties into our hbm.xml
files.
Open the
OrderHeader.hbm.xml
file, which should look something as follows:<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Ordering.Data" assembly="Ordering.Data"> <class name="OrderHeader" table="OrderHeader "> <id name="Id"> <column name="Id"/> <generator class="hilo"/> </id> <property name="Number" type="String"/> <property name="OrderDate" type="DateTime"/> <property name="ItemQty" type="Int32"/> <property name="Total" type="Decimal"/> </class> </hibernate-mapping>
After the
Total
property, just...