I just upgraded a project to version 2.1 and noticed an issue with
some mapping files
Here is the old way (ends up with a NHibernate.MappingException:
Association references unmapped class)

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="Sage.Domain.Entities"
                   namespace="AMEC.EE.Sage.Domain.Entities.App">
  <!--
********************************************************************************
  * Since: November 2008
  * Author: Darin Padlewski
 
**********************************************************************************
-->
  <class name="AMEC.EE.Sage.Domain.Entities.MetaElement`1[[IUnitObj]]"
         table="UnitsMeta"
         schema="App"
         lazy="false"
         dynamic-insert="true"
         dynamic-update="true"
         select-before-update="true">
... the rest of the class map
</class>
  <class name="UnitObj"
         table="Units"
         schema="App"
         lazy="true"
         dynamic-insert="true"
         dynamic-update="true"
         select-before-update="true">
... More mapping
<set name="metaData"
         lazy="true"
         access="field"
         generic="true"
         cascade="all-delete-orphan"
         inverse="true">
      <key column="UnitRowID"/>
      <one-to-many class="AMEC.EE.Sage.Domain.Entities.MetaElement`1
[[AMEC.EE.Sage.Domain.Entities.App.IUnitObj, Sage.Domain.Entities]]" /
>
    </set>

... the rest of the mapping

That used to work in version 2.0
But... the exception when spinning up the session is
NHibernate.MappingException: Association references unmapped class:
AMEC.EE.Sage.Domain.Entities.MetaElement`1
[[AMEC.EE.Sage.Domain.Entities.App.IUnitObj, Sage.Domain.Entities]]

Which is sort of true because in the info logging:
INFO  - Mapping class: AMEC.EE.Sage.Domain.Entities.MetaElement`1
[[AMEC.EE.Sage.Domain.Entities.App.IUnitObj, Sage.Domain.Entities,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null]] -> UnitsMeta
INFO  - Mapping class: AMEC.EE.Sage.Domain.Entities.App.UnitObj ->
Units

So to fix this I had to modify the set to map as follows:
 <set name="metaData"
         lazy="true"
         access="field"
         generic="true"
         cascade="all-delete-orphan"
         inverse="true">
      <key column="UnitRowID"/>
      <one-to-many class="AMEC.EE.Sage.Domain.Entities.MetaElement`1
[[IUnitObj, Sage.Domain.Entities, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=null]]" />
    </set>

So now (in version 2.1) it looks like I need to provide the '
Version=2.0.0.0, Culture=neutral, PublicKeyToken=null' as well.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to