Hi all,
I have to implement a business case that is exaclty like the file system (composite) problem. There is an example in the documentation that shows how to do it. However, it does not work in my case as I do not have just one type (e.g. Node) but 3 types: FileSystemObject as super class and Folder and File, which inherit from it.
This is my mapping file:
Code:
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="false">
<class name="FileSystemObject, X" table="fileSystemObject">
<id name="Id" column="id" type="integer">
<generator class="assigned" />
</id>
<property name="Path" column="path" type="String"/>
<many-to-one name="ParentObject" class="Folder, X" column="parentFolderID"/>
<joined-subclass name="Folder, X" table="folder">
<key column="Id"/>
<property name="NameShown" column="name" type="String"/>
<set name="Children" lazy="true" cascade="all">
<key column="Id"/>
<one-to-many class="FileSystemObject, X"/>
</set>
</joined-subclass>
<joined-subclass name="File, X" table="file">
<key column="Id"/>
<property name="SizeKB" column="sizeKB" type="integer"/>
</joined-subclass>
</class>
</hibernate-mapping>
The ParentObject property works fine, however, the Children property always contains one object, which is an instance of the current object.
Has anybody an idea about what is going wrong here??
Thanks!
Cheers,
Brad[quote][/quote]