I've got a User base class, then a Professional subclass, and then three subclasses of Professional. So I have a base class and two levels deep of subclasses. But the NHibernate mapping file I put together to persist the classes doesn't work as soon as I put in the 3rd level class. Apparently, the XML Schema for the mapping file doesn't allow <discriminator> tags under <subclass> tags, thereby forbidding nested classes. Hibernate 2.x documentation states that this should be allowed.
Is this just not implemented yet, or am I going about it incorrectly?
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0" default-cascade="all-delete-orphan">
<class name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.User, RelateInstituteLogic" table="`user`">
<id name="Id" column="userId" unsaved-value="0">
<generator class="native"/>
</id>
<discriminator column="userType" type="string"/>
<property name="Username" unique="true"/>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Participant, RelateInstituteLogic" discriminator-value="participant">
<property name="ReferralSite"/>
</subclass>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Administrator, RelateInstituteLogic" discriminator-value="administrator">
</subclass>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Professional, RelateInstituteLogic" discriminator-value="professional">
<discriminator column="proType" type="string"/>
<property name="IsApproved"/>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Clergy, RelateInstituteLogic" discriminator-value="clergy">
</subclass>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Educator, RelateInstituteLogic" discriminator-value="educator">
<property name="InstitutionName"/>
</subclass>
<subclass name="Byu.Fhss.Sfl.RelateInstitute.Logic.Accounts.Therapist, RelateInstituteLogic" discriminator-value="therapist">
</subclass>
</subclass>
</class>
</hibernate-mapping>