0

I've been taking a look at the NHProf Nhibernate profiler (Really great tool, but unfortunately priced a bit too highly in my opinion). And it is raises a warning that there is an 'unbounded result set' (the child collection)for my queries of this type (eagerly fetched child collections):

ICriteria criteria = session.CreateCriteria<SomeType>()
                .SetFetchMode("ChildCollection", FetchMode.Eager)
                .Add(Restrictions.IdEq(id));

My question is, how should I be handling this type of query? Is there a way to limit the eagerly fetched results somehow?

The other problem I suppose is that with a limited collection, how to access further results when needed? (I mean I guess there is no lazy loaded after you have populated it). Please tell me if I'm not explaining myself clearly!

Thanks.

UpTheCreek
  • 31,444
  • 34
  • 152
  • 221

1 Answers1

1

You can page over the collection but if you know that collection isn't going to be huge then I'd just ignore that alert. There is also the batch-size collection mapping parameter.

Community
  • 1
  • 1
dotjoe
  • 26,242
  • 5
  • 63
  • 77