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.  [ 4 posts ] 
Author Message
 Post subject: NullReferenceException calling BuildSessionFactory()
PostPosted: Wed Aug 02, 2006 8:55 am 
Newbie

Joined: Tue Apr 04, 2006 4:47 am
Posts: 18
I have now adapted my mapping files and classes (made all accessors virtual and implemented inverse=true on one side of bi-directional relations). Now I am getting an even harder to debug error message. It seems to be about a many-to-one relationship of which I have none in my mappingfiles??

Hibernate version:
1.0.2.0
Mapping documents:
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" lazy="true" inverse="true">
      <key column="GroepID"/>
      <many-to-many column="GebruikerID" class="Persoon"/>
    </bag>
  </class>
</hibernate-mapping>


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" lazy="true">
      <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" lazy="true">
        <key column="GebruikerID"/>
        <many-to-many column="GroepID" class="Groep"/>
      </bag>
    </joined-subclass>
  </class>
</hibernate-mapping>


Full stack trace of any exception that occurs:
Code:
System.NullReferenceException was unhandled by user code
  Message="Object reference not set to an instance of an object."
  Source="NHibernate"
  StackTrace:
       at NHibernate.Cfg.Configuration.Mapping.GetIdentifierType(Type persistentClass)
       at NHibernate.Type.ManyToOneType.GetReferencedType(IMapping mapping)
       at NHibernate.Type.ManyToOneType.GetColumnSpan(IMapping mapping)
       at NHibernate.Mapping.SimpleValue.IsValid(IMapping mapping)
       at NHibernate.Mapping.Collection.Validate(IMapping mapping)
       at NHibernate.Cfg.Configuration.Validate()
       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)

Name and version of the database you are using:
MS SQL Server Express 2005 (9.0.1399)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 9:36 am 
Contributor
Contributor

Joined: Wed May 11, 2005 4:59 pm
Posts: 1766
Location: Prague, Czech Republic
Are you sure about the version? In any case this is a bug, please report it to JIRA (http://jira.nhibernate.org).


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 10:40 am 
Newbie

Joined: Tue Apr 04, 2006 4:47 am
Posts: 18
Yes, this is Build 1.0.2.0. Ok, I will report it as a bug. Thanks for the information.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 02, 2006 10:42 am 
Newbie

Joined: Tue Apr 04, 2006 4:47 am
Posts: 18
*Sorry, double post*


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.