1
我有以下映射:NHibernate的集合映射引发“无法加载或初始化对象或集合”
<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>
而且
<many-to-one name="A"
class="A, Model"
column="A_ID"
not-null="true" />
执行插入和更新工作正常(加时和从集合中移除),但是在抛出异常时总是获取对象结果。
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.
或者......
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.
...这取决于什么对象,你要提取上。 我确定我在这里错过了一件简单的事情,因为它在我实施cascade =“all-delete-orphan”之前曾经工作过。
任何帮助将大大appriciated。
你能张贴您的实体和属于查询失败。 – Nigel 2009-07-17 08:54:52