sagimann wrote:
Hi,
You said that user/schema are CHILDREN of project. Doesn't this mean, in your case, that project should CONTAIN several users/schemas rather than DERIVE from them?
for example:
class Project {
 Collection<User> users;
 Collection<Schema> schemas;
}
?
Hi Sagimann,
Yes, Project has 2 sets of children: children inherited from UserObject and schemaChildren is defined for ISchema.   The following is my mapping file:
Code:
   <class name="IObject" polymorphism="explicit" abstract="true">
      <id name="objectId" column="object_id" unsaved-value="0">
         <generator class="increment" />
      </id>
      <union-subclass name="AbstractObject" abstract="true">
         <property name="name" column="name" type="string" lazy="false" />   
         <union-subclass name="UserObject" table="object">
            <many-to-one name="parent" column="parent_id" class="UserObject" />
            <set name="children" inverse="true" cascade="all-delete-orphan">
               <key column="parent_id" />
               <one-to-many class="UserObject" />
            </set>
            <union-subclass name="Project" table="project">
               <many-to-one name="schemaParent" column="parent_id" class="ISchema" />
               <set name="schemaChildren" inverse="true" cascade="all-delete-orphan">
                  <key column="parent_id" />
                  <one-to-many class="ISchema" />
               </set>
            </union-subclass>   
         </union-subclass>
         <union-subclass name="ISchema" abstract="true">
            <union-subclass name="SchemaObject" table="schema_object">   
               <many-to-one name="schemaParent" column="parent_id" class="ISchema" />
               <set name="schemaChildren" inverse="true" cascade="all-delete-orphan">
                  <key column="parent_id" />
                  <one-to-many class="ISchema" />
               </set>
            </union-subclass>
         </union-subclass>
      </union-subclass>
   </class>
I don't know how to use <any> mapping to associate ISchema and Project.
Thanks,
-ZJ