These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: Mapped class not being recognised
PostPosted: Tue Aug 01, 2006 10:56 am 
Newbie

Joined: Tue Apr 04, 2006 4:47 am
Posts: 18
Somehow NHibernate doesn't recognise the class Persoon even though I have clearly mapped it. Any ideas?

NHibernate version:
1.0.2.0
Mapping documents:
Persoon.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
                   namespace="Symtech.Verzuiminzicht.BO" assembly="Symtech.Verzuiminzicht.BO">
  <class name="Persoon" table="Persoon">
    <id name="ID" type="Int32" access="nosetter">
      <column name="ID" not-null="true"/>
      <generator class="native" />
    </id>
    <property name="Achternaam" type="String" column="Achternaam" not-null="true"/>
    <joined-subclass name="Gebruiker" table="Gebruiker">
      <key column="PersoonID"/>
      <property name="Naam" type="String" column="Naam" not-null="true"/>
      <property name="Wachtwoord" type="String" column="Wachtwoord" not-null="true"/>
      <property name="Email" type="String" column="Email" not-null="true"/>
      <bag name="Groep" table="Gebruiker_Groep" cascade="all">
        <key column="GebruikerID"/>
        <many-to-many column="GroepID" class="Groep"/>
      </bag>
    </joined-subclass>
  </class>
</hibernate-mapping>

Groep.hbm.xml
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"
                   namespace="Symtech.Verzuiminzicht.BO" assembly="Symtech.Verzuiminzicht.BO">
  <class name="Groep" table="Groep">
    <id name="ID" type="Int32" access="nosetter">
      <column name="ID" not-null="true"/>
      <generator class="native" />
    </id>
    <property name="Naam" type="String" column="Naam" not-null="true"/>
    <bag name="Personen" table="Gebruiker_Groep" cascade="all">
      <key column="GroepID"/>
      <many-to-many column="GebruikerID" class="Persoon"/>
    </bag>
  </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Code:
NHibernate.MappingException was unhandled by user code
  Message="An association from the table Gebruiker_Groep refers to an unmapped class: Persoon"
  Source="NHibernate"
  StackTrace:
       at NHibernate.Cfg.Configuration.SecondPassCompileForeignKeys(Table table, ISet done)
       at NHibernate.Cfg.Configuration.SecondPassCompile()
       at NHibernate.Cfg.Configuration.BuildSessionFactory()
       at Symtech.Verzuiminzicht.DA.NHibernateHttpModule.CreateSessionFactory() in D:\projecten\verzuiminzicht\VI_Business\Symtech.Verzuiminzicht.Factories\NHibernateHttpModule.cs:line 84
       at Symtech.Verzuiminzicht.DA.NHibernateHttpModule.get_CurrentFactory() in D:\projecten\verzuiminzicht\VI_Business\Symtech.Verzuiminzicht.Factories\NHibernateHttpModule.cs:line 125
       at Symtech.Verzuiminzicht.DA.NHibernateHttpModule.CreateSession() in D:\projecten\verzuiminzicht\VI_Business\Symtech.Verzuiminzicht.Factories\NHibernateHttpModule.cs:line 139
       at Symtech.Verzuiminzicht.DA.NHibernateHttpModule.get_CurrentSession() in D:\projecten\verzuiminzicht\VI_Business\Symtech.Verzuiminzicht.Factories\NHibernateHttpModule.cs:line 186
       at Symtech.Verzuiminzicht.DA.GebruikerFactory.Save(Gebruiker gebr) in D:\projecten\verzuiminzicht\VI_Business\Symtech.Verzuiminzicht.Factories\GebruikerFactory.cs:line 13
       at Default2.butOpslaan_Click(Object sender, EventArgs e) in d:\projecten\verzuiminzicht\website\Install.aspx.cs:line 77
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 01, 2006 3:45 pm 
Expert
Expert

Joined: Fri May 13, 2005 5:56 pm
Posts: 308
Location: Santa Barbara, California, USA
is Persoon.hbm.xml configured as an Embedded Resource?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 5:52 am 
Newbie

Joined: Tue Apr 04, 2006 4:47 am
Posts: 18
devonl wrote:
is Persoon.hbm.xml configured as an Embedded Resource?

Yes, both mapping files are and I have manually rebuilt the solution on changes.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 9:46 am 
Newbie

Joined: Mon Jul 31, 2006 6:02 am
Posts: 2
Location: canda
first check ur mappings are in classpath

and the follow the proper folder structure

for your name attribute in the class tag


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 10:00 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
This advice is not really applicable to the .NET port.
dirk_louwers: There must be something wrong in your setup, unfortunately it's not really possible to help with this remotely. Try enabling the logs and look whether Configuration ever notices the Persoon object.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.