Hi, I've got following mappings:
<bag name="BList" table="A_TABLE" inverse="true" lazy="false" cascade="all-delete-orphan">
<key column="A_ID"/>
<one-to-many
class="B, Model" />
</bag>
And
<many-to-one name="A"
class="A, Model"
column="A_ID"
not-null="true" />
Performing insert and updates are working fine (when adding and removing from the collection), but fetching the objects result always in exceptions thrown.
failed: NHibernate.Exceptions.GenericADOException : could not load an entity: [Model.B#5816932][SQL: SELECT ...]
----> System.NullReferenceException : Object reference not set to an instance of an object.
OR...
NHibernate.Exceptions.GenericADOException : could not initialize a collection: [Model.A.BList#1364389][SQL: ...]
----> System.NullReferenceException : Object reference not set to an instance of an object.
... depending on what object you're fetching. I'm sure I'm missing a simple thing here because it used to work before I implemented the cascade="all-delete-orphan".
Any help would be greatly appriciated.