Hello,
it seems to me that NHibernate doesn't want return the collection of child objects that are in the same class hierarchy as the parent.
In the following example I have base class QuestionBase and 2 derived classes Question & Group.
Object Group contains collection of Question objects.
I have created one group in the DB and inserted a few Questions in the Group.
But when I retrieve this Group via NHibernate and look at it's Questions collection, it is always empty.
What is the reason?
Mapping file:
Code:
<class name="QuestionBase" table="Question" discriminator-value="b">
  <id name="Id" type="Int32" column="QuestionID" unsaved-value="0">
   <generator class="identity" />
  </id>
  <discriminator column="Type" type="Char" />
  <property name="Text" type="String" not-null="true" />
 
  <subclass name="Question" discriminator-value="q">
    <property name="Name" type="String" length="10" />
   <property name="Mandatory" type="Boolean"  />
   <many-to-one name="Group" column="GroupID" class="Group" />
  </subclass>  
  <subclass name="Group" discriminator-value="g">
     <set name="Questions" inverse="true" lazy="true">
       <key column="QuestionID" />
        <one-to-many class="Question" />
      </set>
  </subclass>
 
</class>