I'm beating my head against the wall here and hope to get some help
from somebody - anybody. I have a goofy table relationship on a one-
to-many mapping. I am trying to use a sql-query to define my query
and reference it via loader element in my one-to-many relationship
mapping. I've included the relevant bits below. The sql that is
being output from this looks good, so I have no idea why I am getting
this NullReferenceException when I try to access the Count property of
my list of CreditCard objects? I tried this on another similar
collection mapping and got the same results, so I'm not sure what I'm
doing wrong.
NULL happening here. Why is PersistentBag null?
NHibernate.Collection.PersistentBag.get_Count()
----------
Mapping
----------
<bag cascade="save-update" name="CreditCards" mutable="true">
<key>
<column name="`POLICY_NUMBER`" />
<column name="`POLICY_DATE_TIME`" />
</key>
<one-to-many class="Policy.InfoLayer.CrdtCardAcctRecord,
NHibernate.Spike.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
<loader query-ref="LoadCreditCards" />
</bag>
<many-to-one class="Policy.InfoLayer.ClientRecord,
NHibernate.Spike.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" name="Client">
<column name="`Client_id`" />
</many-to-one>
</class>
<sql-query name="LoadCreditCards">
<return alias="cc" class="Policy.InfoLayer.CrdtCardAcctRecord,
NHibernate.Spike.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null" />
<![CDATA[
SELECT {cc.*}
FROM CRDT_CARD_ACCT {cc}
WHERE {cc}.POL_NBR = ? and {cc}.EXP_DT <> ?
]]>
</sql-query>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.