2009/7/23 desfen <[email protected]> > > Fabio, thanks for answering. > > However your response doesn't make sense to me. I don't understand > what you are saying. > > By "empty collection" I meant an empty collection of child objects. > E.g. A Customer whose (lazy) .Orders collection is empty > because they haven't ordered anything yet. > > When we issue an eager fetch like this: > > FROM Customer c JOIN FETCH c.Orders ord > > NHibernate doesn't initialize the Orders collection if no rows are > returned for it from the database. This is by design as we can see > in the code. > > HOWEVER, with the help of Craig (from CRG Software) we have found a > solution. He replied by e-mail instead of in this forum but we owe him > great thanks. We also owe ourselves a big hit to the forehead. His > solution > is logical and we should have thought of it ourselves. > > For future record (for anyone reading this), the solution is to use > LEFT JOIN FETCH instead: > > FROM Customer c LEFT JOIN FETCH c.Orders ord > > D'oh ! > > Hope this helps anyone. > > Sven > > PS: we never thought of doing this because we thought JOIN FETCH was > the > defaulted to performing LEFT JOIN FETCH. Apparently this is no > (longer ?) true. > > >
-- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
