I'm stuck with several properties in a mapping (many-to-one, many-to-many, one-to-many) where I everywhere defined lazy="true"
(for many-to-one: lazy="proxy"
). Here an开发者_开发问答 example within the mapped class HelperPerson
:
<set name="WorkingTimes" inverse="true" cascade="all-delete-orphan" lazy="true">
<key column="PersonId"/>
<one-to-many class="Proj.Model.WorkingTime, Proj"/>
</set>
It doesn't help anything. NHibernate fires for each row of the connected WorkingTimes
a query (by the way, it wont change anything if I use lazy="false" fetch="join"
) right after I call the .List
-function (before touching any property which should trigger the query):
NHibernate.IQuery hibQuery = _HibSession.CreateQuery("SELECT hp FROM Proj.Model.HelperPerson hp WHERE hp.Person.PersonId = 19 ");
hibQuery.List(resList);
Do I forget something obvious? Or could there be something like a hidden, global configuration which tells NHibernate to ignore lazy-loading in general?
Thx for any tipps! sl3dg3
Turns out that there was some logic going on within the setter, which triggered NHibernate to load everything. Setter and logic = evil... :-/
精彩评论