I have two mapping files:
KnowledgeBase.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="SimpliCity.Business.KnowledgeBase, SimpliCity.Business" table="KNOWLEDGEBASE">
<id name="Id" column="ID" type="System.Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="Topic" column="TOPIC" />
<property name="Text" column="TEXT" />
<property name="Keywords" column="KEYWORDS" />
<many-to-one name="Department" class="SimpliCity.Business.Department, SimpliCity.Business" column="DEPARTMENT_ID" />
<property name="IsInternal" column="INTERNAL_FLAG" type="true_false"/>
<property name="LastUpdatedDate" column="LAST_UPDATED_DATE" />
<property name="OverallRanking" column="OVERALL_RANKING" />
<property name="DailyRanking" column="DAILY_RANKING" />
<property name="CreationDate" column="CREATION_DATE" />
<property name="LastUpdatedBy" column="LAST_UPDATED_BY_ID" />
<property name="CreatedBy" column="CREATED_BY_ID" />
</class>
</hibernate-mapping>
Department.hbm.xmlCode:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="SimpliCity.Business.Department, SimpliCity.Business" table="DEPARTMENTS">
<id name="Id" column="ID" type="System.Int32" unsaved-value="0">
<generator class="native" />
</id>
<property name="Name" column="NAME" />
<property name="ServicePhoneNumber" column="SERVICE_PHONE_NO" />
<property name="EmailAddress" column="EMAIL_ADDRESS" />
<property name="Code" column="CODE" />
<property name="LastUpdatedDate" column="LAST_UPDATED_DATE" />
<property name="CreationDate" column="CREATION_DATE" />
<property name="LastUpdatedBy" column="LAST_UPDATED_BY_ID" />
<property name="CreatedBy" column="CREATED_BY_ID" />
</class>
</hibernate-mapping>
When configuration is run, I get the following error message:
An association from the table KNOWLEDGEBASE refers to an unmapped class: Department
Quote:
[MappingException: An association from the table KNOWLEDGEBASE refers to an unmapped class: Department]
NHibernate.Cfg.Configuration.SecondPassCompileForeignKeys(Table table, ISet done) +438
NHibernate.Cfg.Configuration.SecondPassCompile() +906
NHibernate.Cfg.Configuration.BuildSessionFactory() +12
SimpliCity.ObjectAccess.ObjectAccessManager.OpenSession() in C:\Projects\SimpliService\ObjectAccess\ObjectAccessManager.cs:49
SimpliCity.ObjectAccess.Http.NHibernateHttpModule.ContextBeginRequest(Object sender, EventArgs e) in C:\Projects\SimpliService\ObjectAccess\NHibernateHttpModule.cs:37
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +92
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +64
I'm sure this is a Newbie error, but any help would be greatly appreciated.