I have two tables, Vehicle and Make. The two are joined using the MakeId as a foreign key on the Vehicle table. My mapping file looks similar to this
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Demo.Business.Objects.Vehicle, Demo.Business.Objects" table="Vehicle" >
<id name="VehicleId" type="int" >
<generator class="native" />
</id>
<property name="RegNumber" type="String" />
<property name="VehicleId" type="int" />
<property name="CustomerId" type="int" />
<join table="Make" fetch="join">
<key column="MakeId" foreign-key="MakeId"/>
<property name="Description" type="String" />
</join>
</class>
</hibernate-mapping>
I would have thought that this would join the two tables on the make id, however the SQL that ios generated tries the following join: vehicle.vehicleid = make.makeid.
How can I get this to work? I.e. I expect:
select * from Vehicle
inner join Make on Make.MakeId = Vehicle.Make Id