I posted a message on the old forums (which still seem quite active) but got no reply there so I'll try here.
We've been digging into the very rich possibilties that NHibernate provides for efficient querying and eager fetching and we *lurve* it BUT we seem to have hit a bit of a snag: When a parent object's child collection is empty, NHibernate neglects to properly init the collection. As far as we can see from looking at the source, this is by design. If there's no data for the collection, NHibernate doesn't get around to initing the collection. We have been trying to change this behaviour because we don't want lazy init exceptions thrown when we access an empty collection. However we can't seem to get our head around this problem and we can't seem to find a way to fix this. We do have a ridiculous workaround, in which we loop over our objects (and their children's children's children, it's a deep query) and "touch" every child collection before closing the session. In the case of many empty child collections this will degenerate into the SELECT N + 1 anti-pattern, which we wanted to avoid in the first place by using multi-queries for our deep object queries. I have found an old but relevant bug in JIRA that seems to getting pushed forward with every release. http://nhjira.koah.net/browse/NH-1211 We get the impression that there's a (better) trick for working around this problem because nobody seems to be overly concerned about fixing this. Can anbody please give us some more info on this ? Thank you so much ! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
