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
|