Just thought I would share the solution I used in the end.
I used a discriminator column on the BuildingComponent table, and then had a class for BuildingComponent and inherited from this for RoomBuildingComponent, FloorBuildingComponent and PropertyBuildingComponent.
The mapping file to achieve this is:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
namespace="xxx" assembly="xxx">
<class name="BuildingComponent" table="BuildingComponent" discriminator-value="0">
<id name="Id" unsaved-value="-9999">
<column name="BctId" sql-type="Int32" not-null="true"/>
<generator class="increment" />
</id>
<discriminator column="BctType" type="int"/>
<property name="Name" column="BctName" />
Other properties ..
<subclass name="PropertyBuildingComponent" discriminator-value="1">
<many-to-one name="Property" class="Property" column="PrpId" />
</subclass>
<subclass name="FloorBuildingComponent" discriminator-value="2">
<many-to-one name="Property" class="Property" column="PrpId" />
<many-to-one name="Floor" class="Floor" column="FlrId" />
</subclass>
<subclass name="RoomBuildingComponent" discriminator-value="3">
<many-to-one name="Property" class="Property" column="PrpId" />
<many-to-one name="Floor" class="Floor" column="FlrId" />
<many-to-one name="Room" class="Room" column="RomId" />
</subclass>
</class>
</hibernate-mapping>