Nhibernate Criteria Ignore Child Collection
Posted
by CocoB
on Stack Overflow
See other posts from Stack Overflow
or by CocoB
Published on 2010-03-18T00:31:21Z
Indexed on
2010/03/18
0:41 UTC
Read the original article
Hit count: 426
nhibernate
|criteria
I have a simple one to many association in my model. The parent class has a collection of children. In the mapping files, the association is a one to many, eager-loaded, using fetchmode.join. This works fine, but how can I write a criteria query but NOT trigger the loading of the child collection? In other words, I want to query the parent and not have it generate the join in the resulting sql. I tried setting the fetch mode to lazy, but in that case Nhibernate generates two separate queries. I don't want the table for child queried at all.
© Stack Overflow or respective owner