Hibernate version:1.2
Mapping documents:
base class mapping:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Farayan.Common.EntityLayer" namespace="Farayan.Common.EntityLayer.Membership" >
<class name="ProfileEntity" table="OrmMembership_ProfilesTable">
<id name="Id" type="string" access="nosetter.camelcase">
<generator class="uuid.hex"/>
</id>
<version unsaved-value="-1" name="Version"/>
<property name="CreationTime" type="datetime"/>
<many-to-one name="User" column="UserId"/>
<property name="FirstName"/>
<property name="LastName"/>
<many-to-one name="DefaultAddress" cascade="all"/>
<many-to-one name="HomeAddress" cascade="all"/>
<many-to-one name="WorkAddress" cascade="all"/>
<property name="CellNumber"/>
<property name="CallNumber"/>
<property name="EmailAddress"/>
<property name="Url"/>
<property name="DefaultUrl"/>
<property name="Theme"/>
<property name="Culture"/>
<property name="Gender"/>
<property name="PictureRelativeUrl"/>
<property name="PictureAbsoluteUrl"/>
<property name="Title"/>
<set name="Addresses" cascade="all-delete-orphan" lazy="true">
<key column="Profile"/>
<one-to-many class="AddressEntity"/>
</set>
</class>
</hibernate-mapping>
sub class mapping:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="Farayan.ConferenceManager.EntityLayer" namespace="Farayan.ConferenceManager.EntityLayer.Membership" >
<joined-subclass name="ExtendedProfileEntity" extends="Farayan.Common.EntityLayer.Membership.ProfileEntity, Farayan.Common.EntityLayer" table="OrmMembership_ExtendedProfilesTable">
<key column="Id"/>
<property name="EducationalLevel"/>
<property name="EducationalField"/>
<property name="University"/>
<property name="RegisterReason"/>
<property name="ClaimedAsAssociationMembership" type="boolean"/>
<property name="ApprovedAssociationMember" type="boolean"/>
<property name="ClaimedAsStudent" type="boolean"/>
<property name="ApprovedAsStudent" type="boolean"/>
<property name="StudentCardPictureRelativeUrl"/>
<property name="StudentCardPictureRealUrl"/>
<property name="MembershipCardPictureRelativeUrl"/>
<property name="MembershipCardPictureRealUrl"/>
</joined-subclass>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:Code:
[MappingException: These classes extend unmapped classes:
Farayan.ConferenceManager.EntityLayer.Membership.ExtendedProfileEntity, Farayan.ConferenceManager.EntityLayer extends Farayan.Common.EntityLayer.Membership.ProfileEntity, Farayan.Common.EntityLayer]
NHibernate.Cfg.AssemblyHbmOrderer.OrderedHbmFiles(ISet unorderedClasses) +623
NHibernate.Cfg.AssemblyHbmOrderer.GetHbmFiles() +724
NHibernate.Cfg.Configuration.AddResources(Assembly assembly, IList resources, Boolean skipOrdering) +58
NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly) +26
Farayan.Layering.DataLayer.Hibernate.NHibernateSessionManager..ctor() in E:\Projects\Farayan\Farayan.Layering\DataLayer\NHibernateSessionManager.cs:41
Farayan.Layering.DataLayer.Hibernate.Nested..cctor() in E:\Projects\Farayan\Farayan.Layering\DataLayer\NHibernateSessionManager.cs:70
[TypeInitializationException: The type initializer for 'Nested' threw an exception.]
Farayan.Layering.DataLayer.Hibernate.NHibernateSessionManager.get_Instance() in E:\Projects\Farayan\Farayan.Layering\DataLayer\NHibernateSessionManager.cs:26
Farayan.Layering.DataLayer.BaseDataLayer`3.CreateQuery(String query, Object[] values, IType[] types) in E:\Projects\Farayan\Farayan.Layering\DataLayer\BaseDataLayer.cs:822
Farayan.Layering.DataLayer.BaseDataLayer`3.GetUniqueResult(String query, Object[] values, IType[] types) in E:\Projects\Farayan\Farayan.Layering\DataLayer\BaseDataLayer.cs:674
Farayan.Layering.DataLayer.BaseDataLayer`3.GetUniqueResult(String query, Object value, IType type) in E:\Projects\Farayan\Farayan.Layering\DataLayer\BaseDataLayer.cs:664
Farayan.Layering.Config.ApplicationDataLayer.FindRelatedConfig(String domain) in E:\Projects\Farayan\Farayan.Layering\Config\ApplicationDataLayer.cs:100
Farayan.Layering.Config.ApplicationBusinessLayer.FindCurrentApplication() in E:\Projects\Farayan\Farayan.Layering\Config\ApplicationBusinessLayer.cs:16
Farayan.Layering.Config.ApplicationBusinessLayer.get_CurrentApplication() in E:\Projects\Farayan\Farayan.Layering\Config\ApplicationBusinessLayer.cs:25
GeneralPage.OnPreInit(EventArgs e) in e:\Projects\ConferenceManager\Project\Website\App_Code\GeneralPage.cs:20
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +663
Name and version of the database you are using:
SQLExpress 2005
------------------------------
Hi, i have two entity assembly, in one (Farayan.Common.EntityLayer) i defined ProfileEntity and in other (Farayan.ConferenceManager.EntityLayer) i defined ExtendedProfileEntity which inherits from ProfileEntity in Farayan.Common.EntityLayer.
in NH 1.0.2, i mapped both and no problem exists, but when i upgrade to 1.2, when i embed ExtendedProfileEntity mapping in assembly, a mapping exception will be thrown
i checked for order of adding assembly for configuration, first i add Farayan.Common.EntityLayer (which has super class - ProfileEntity) and second other assembly. but problem remained.
can any one help me?