Well, so far not luck. Let's forget about persons and concentrate on the composite.
The closest I got was with the following map:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" namespace="InfoLib" assembly="InfoLib">
<class name="InfoComponent" table="CompositeInfo">
<id name="Id" column="id" type="Int32" unsaved-value="0">
<generator class="native" />
</id>
<discriminator column="discr" type="string" length="1" />
<property name="Name" column="name" type="String" length="50" />
<property name="Description" column="descr" type="String" length="50" />
<subclass discriminator-value="A" name="AtomicInfo"></subclass>
<subclass discriminator-value="C" name="CompositeInfo">
<map name="Components" table="parentchild" inverse="true" cascade="save-update" >
<key>
<column name="Id" />
</key>
<index-many-to-many class="CompositeInfo" column="parentID" />
<many-to-many class="InfoComponent" column="childID" />
</map>
</subclass>
</class>
</hibernate-mapping>
This gets me as far as inserting the composites but not updating the relationship table (composite x contains infocomponent)
Being a newbien in hibernate I really got this by playing around. So I don't have an understanding of why I need the inverse="true". Also I'm not sure about the correctness of the index-many-to-many and many-to-many.
Any further help will be really appreciated.
Thanks,
gg
PS. If you want I can strip down the code and include it here... I didn't cause I don't think it will really help...