I have two tables: Vehicle and Make. These two connections are connected using MakeId as a foreign key on the Vehicle table. My mapping file is 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 think that this would join the two tables of the make identifier, however the SQL created by ios tries the following connection: vehicle.vehicleid = make.makeid.
How can I make this work? That is, I expect:
select * from Vehicle
inner join Make on Make.MakeId = Vehicle.Make Id
source
share