Here are my mapping files
Vehicle
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="FleetManagement.BusinessLayer.Vehicle, FleetManagement.BusinessLayer" table="Vehicle">
<id name="VehicleID" column="VehicleID" type="String" length="50">
<generator class="assigned" />
</id>
<!--Mapp properties I'd like to be persist/fetch
Assume colum = property name-->
<property name="UnitID" />
<property name="Body_Type" />
<property name="Make" />
<property name="Model" />
<property name="Year" />
<set name="Schedules" table="Vehicle_Schedule" lazy="false" cascade="save-update" >
<key column="VehicleID" />
<many-to-many class="FleetManagement.BusinessLayer.Schedule, FleetManagement.BusinessLayer"
column="InspectionID" outer-join="auto" />
</set>
<set name="Vehicle_Schedule" table="Vehicle_Schedule" lazy ="false" cascade="save-update" inverse ="true" >
<key column="VehicleID" />
<one-to-many class="FleetManagement.BusinessLayer.Vehicle_Schedule, FleetManagement.BusinessLayer" />
</set>
<set name="Mileages" table="FuelMileage" lazy="true" cascade="save-update" >
<key column="MileageID" />
<one-to-many class="FleetManagement.BusinessLayer.Mileage, FleetManagement.BusinessLayer" />
</set>
<!--Map the inherited Class Truck-->
<joined-subclass name="FleetManagement.BusinessLayer.Truck, FleetManagement.BusinessLayer" table="Truck">
<key column="TruckID" foreign-key="FK_VehicleID" />
<property name="TireSize" />
<property name="Weight" column="GrossWeight"/>
<!--Join the SubClass Pickup-->
<joined-subclass name="FleetManagement.BusinessLayer.Pickup, FleetManagement.BusinessLayer" table="PickUp">
<key column="PickUpID" foreign-key="FK_TruckID" />
<property name="IsDOT" />
</joined-subclass>
</joined-subclass>
<joined-subclass name="FleetManagement.BusinessLayer.Forklift, FleetManagement.BusinessLayer" check="Forklift">
<key column="ForkliftID" foreign-key="fk_VehicleID" />
<property name="Category" />
<property name="Manufacturer" />
</joined-subclass>
</class>
</hibernate-mapping>
Vehicle_ScheduleCode:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="FleetManagement.BusinessLayer.Vehicle_Schedule, FleetManagement.BusinessLayer" table="Vehicle_Schedule">
<composite-id>
<key-many-to-one name="Vehicle" class="FleetManagement.BusinessLayer.Vehicle, FleetManagement.BusinessLayer" column="VehicleID" />
<key-many-to-one name="Schedule" class="FleetManagement.BusinessLayer.Schedule, FleetManagement.BusinessLayer" column="InspectionID" />
</composite-id>
<property name="LastChecked" />
</class>
</hibernate-mapping>
[/code]