Hi, I am new to NHibernate and am having some major difficulties. I am using a WCF hosting application developed by another developer in my organisation. The problem I am having is when I try to send my populated object across the wire I get "Object reference not set to an instance of an object". A little about my class structure: I have a class design for patient data. It is made up of many Collection properties e.g. IList<PatientAddress> patientAddresses, IList<PatientIdentifier> patientIdentifiers and so on. If I populate one of the ILists it works fine, but when I attempt to populate more than one I get the above error.
My Configuration File looks like this
<?xml version="1.0" encoding="utf-8" ?> <!-- Maps to the Patient Domain Object --> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"> <class name="NISG.Framework.PatientModule.Domain.Classes.Patient, NISG.Framework.PatientModule.Domain" table="tbl_patients" lazy="false"> <id name="Id" type="System.Guid" unsaved-value="00000000-0000-0000-0000-000000000000" column="patient_id"> <generator class="guid.comb"/> </id> <property name="DateOfBirth" column="date_of_birth"/> <property name="DateOfDeath" column="date_of_death"/> <property name="GenderAtBirth" column="gender_at_birth"/> <property name="MaritalStatus" column="marital_status"/> <property name ="CurrentGender" column="current_gender"/>
<bag name="Names" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.PatientName, NISG.Framework.PatientModule.Domain"/> </bag> <bag name="Addresses" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.PatientAddress, NISG.Framework.PatientModule.Domain"/> </bag> <bag name="PatientIdentifiers" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.PatientIdentifier, NISG.Framework.PatientModule.Domain"/> </bag> <bag name="AssociatedPeople" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.AssociatedPerson, NISG.Framework.PatientModule.Domain"/> </bag> <bag name="TelephoneNumbers" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.PatientTelephoneNumber, NISG.Framework.PatientModule.Domain"/> </bag> <bag name="EletronicContacts" cascade="all"> <key column="patient_id"/> <one-to-many class="NISG.Framework.PatientModule.Domain.Classes.PatientElectronicContact, NISG.Framework.PatientModule.Domain"/> </bag> </class> </hibernate-mapping> Please Help... my head is sore from the repeated battering on the wall... Cheers, Mark
|