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.  [ 1 post ] 
Author Message
 Post subject: Abstract Set Mapping gives System.NullReferenceException
PostPosted: Mon Jan 22, 2007 12:30 am 
Newbie

Joined: Thu Aug 10, 2006 10:08 pm
Posts: 12
Hi everyone.

I'm getting an exception and i have no idea how to trace it back ot the source. esentially it is a null reference exception but the object is null inside the NHibernate code.

This is my first atempt at setting up a set mapping, i had it working in reverse on these two objects until i realised i had built it wrong. switiching it around has caused it to break.

Could it have something to do with the abstract class? (EFTBatch is an abstract class with 3 subclasses, these have been working sucesfully in NHibernate)


Mapping documents:

<class name='EFTSubmission' table='EFTSubmission'>
<id type='int' column='EFTSubmissionID' >
<generator class='identity' />
</id>

<property name='ClosedBy' column='closedBy' type='string' />

<property name='CreatedBy' column='createdBy' type='string' />

<property name='DateClosed' column='dateClosed' type='string' />

<property name='DateCreated' column='dateCreated' type='string' />

<property name='Name' column='name' type='string' />

<set name="BatchSet" table="EFTBatch" cascade="save-update">
<key column="eFTsubmissionID"/>
<one-to-many class="EFTBatch" />
</set>
</class>

Code between sessionFactory.openSession() and session.close():

EFTSubmission esub = new EFTSubmission();
esub.BatchSet = new Iesi.Collections.HashedSet();
esub.BatchSet.Add(eftBatch);
esub.BatchSet.Add(eftBatch1);
esub.BatchSet.Add(eftBatch2);



Full stack trace of any exception that occurs:
eftrerun.readWriteTest.writeBatch : NHibernate.ADOException : Could not save object
----> System.NullReferenceException : Object reference not set to an instance of an object.

at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction action, Object anything)
at NHibernate.Impl.SessionImpl.Save(Object obj)
at NHibernate.Impl.SessionImpl.SaveOrUpdate(Object obj)
at readWriteTest.writeBatch() in c:\projects\eftrerun\eftrerun\eftrerun-test\readwritetest.cs:line 69
--ADOException
at NHibernate.Property.BasicSetter.Set(Object target, Object value)
at NHibernate.Persister.AbstractEntityPersister.SetPropertyValues(Object obj, Object[] values)
at NHibernate.Impl.SessionImpl.DoSave(Object theObj, Key key, IClassPersister persister, Boolean replicate, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything)
at NHibernate.Impl.SessionImpl.DoSave(Object obj, Object id, IClassPersister persister, Boolean useIdentityColumn, CascadingAction cascadeAction, Object anything)
at NHibernate.Impl.SessionImpl.SaveWithGeneratedIdentifier(Object obj, CascadingAction


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

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.