I'm having a little trouble with the NHibernate.Mapping.Attributes in my project with regards to the JoinedSubclass tag. I have two tables, Faculty and User, where Faculty is a joined-subclass of User.
Code:
[JoinedSubclass("Faculty",typeof(User))]
[JoinedSubclassKey("UserID")]
Internal class Faculty : User
Code:
- <class name="edu.depaul.cti.col.DataAccessLayer.DataObjects.User, DataAccessLayer" table="[User]">
- <id name="Id" type="Int32" column="UserID" access="property" unsaved-value="0">
<generator class="NHibernate.Id.IdentityGenerator, NHibernate" />
</id>
<property name="LoginName" column="LoginName" access="property" type="String" />
<property name="ExpireDate" column="ExpireDate" access="property" type="DateTime" />
<property name="Password" column="[Password]" access="property" type="String" />
<property name="Prefix" column="Prefix" access="property" type="String" />
<property name="FirstName" column="FirstName" access="property" type="String" />
<property name="MiddleName" column="MiddleName" access="property" type="String" />
<property name="LastName" column="LastName" access="property" type="String" />
<property name="Gender" column="Gender" access="property" type="String" />
<property name="EMail" column="EMail" access="property" type="String" />
<property name="AlternateEMail" column="UseAlternateEMail" access="property" type="String" />
<property name="UseAlternateEMail" column="IsAlternateEMail" access="property" type="String" />
<property name="DataSourceFlag" column="DataSourceFlag" access="property" type="String" />
<property name="DataSourceReferenceID" column="DataSourceReferenceID" access="property" type="String" />
<property name="Status" column="Status" access="property" type="String" />
<property name="CreateTime" column="CreateTime" access="property" type="DateTime" />
<property name="UpdateTime" column="UpdateTime" access="property" type="DateTime" />
- <set name="CreatedAssignments" table="Assignment" access="property" lazy="true">
<key column="CreatorID" />
<one-to-many class="edu.depaul.cti.col.DataAccessLayer.DataObjects.Assignment, DataAccessLayer" />
</set>
- <!-- edu.depaul.cti.col.DataAccessLayer.DataObjects.Faculty, DataAccessLayer
-->
- <joined-subclass name="edu.depaul.cti.col.DataAccessLayer.DataObjects.Faculty, DataAccessLayer" table="Faculty">
<key column="UserID" />
<property name="Title" column="Title" access="property" type="String" />
<property name="Office" column="Office" access="property" type="String" />
<property name="OfficePhone" column="OfficePhone" access="property" type="String" />
<property name="Homepage" column="Homepage" access="property" type="String" />
<property name="InforPage" column="InforPage" access="property" type="String" />
<property name="OtherInfo" column="OtherInfo" access="property" type="String" />
<property name="LoginName" column="LoginName" access="property" type="String" />
<property name="ExpireDate" column="ExpireDate" access="property" type="DateTime" />
<property name="Password" column="[Password]" access="property" type="String" />
<property name="Prefix" column="Prefix" access="property" type="String" />
<property name="FirstName" column="FirstName" access="property" type="String" />
<property name="MiddleName" column="MiddleName" access="property" type="String" />
<property name="LastName" column="LastName" access="property" type="String" />
<property name="Gender" column="Gender" access="property" type="String" />
<property name="EMail" column="EMail" access="property" type="String" />
<property name="AlternateEMail" column="UseAlternateEMail" access="property" type="String" />
<property name="UseAlternateEMail" column="IsAlternateEMail" access="property" type="String" />
<property name="DataSourceFlag" column="DataSourceFlag" access="property" type="String" />
<property name="DataSourceReferenceID" column="DataSourceReferenceID" access="property" type="String" />
<property name="Status" column="Status" access="property" type="String" />
<property name="CreateTime" column="CreateTime" access="property" type="DateTime" />
<property name="UpdateTime" column="UpdateTime" access="property" type="DateTime" />
- <set name="CreatedAssignments" table="Assignment" access="property" lazy="true">
<key column="CreatorID" />
<one-to-many class="edu.depaul.cti.col.DataAccessLayer.DataObjects.Assignment, DataAccessLayer" />
</set>
<many-to-one name="School" column="SchoolID" access="property" class="edu.depaul.cti.col.DataAccessLayer.DataObjects.School, DataAccessLayer" />
</joined-subclass>
</class>
Now when I dump out the XML mapping that I get when I have this, it thinks that all of the properties in User are also in Faculty (fields that don't exist in Faculty but in User are trying to be mapped distinctly in Faculty), but this isn't what I want. Am I using these tags correctly?