I have two table ABC, CBZ
ABC contains ID as primary key
CBZ contains ParentId and ChildID as composite key
relation between ABC and CBZ is many to many, i have confusion with relationship amongs the mappings, i have given mapping for the two tables as below.
Mapping for Parent Table
<Class name="NodeBase">
<subclass name="MyAssembly.Node, MyAssembly" discriminator-value="0" >
<bag name="Nodes" table="ABC">
<key column="ParentID" />
<many-to-many class="MYAssembly.NodeRelation, MyAssembly" unique="true" />
</bag>
</subclass>
</Class>
Mapping for Child Table
<class name="MyAsembly.NodeRelation, MyAssembly" table="CBZ" >
<property name="GroupName" column="GroupName" type="string" not-null="true" />
<property name="ProjectName" column="ProjectName" type="string" not-null="true" />
<one-to-one name="Node" column="ChildID" class="MyAssembly.NodeBase, MyAssembly" not-null="true" />
</class>
|