| Hello, I am a beginner in whole hibernate concept, trying to implement optional loading of master-detail association. I realize that there is a lazy load option, but since my entities are loaded in to a List as part of a message to be sent, all nested lazy collections get populatedall all the time.So far I could come up only with generating outer join and filter out details by setting a criteria FK_Field IS NULL:
 
 if (!request.ReturnDetails)
 criteria.CreateCriteria("Detail", NHibernate.SqlCommand.JoinType.LeftOuterJoin).Add(Expression.IsNull("FKMasterId"));
 
 I hope it is not the best solution, which nHibernate could provide and would highly appreciate help with it.
 Thanks.
 
 
 |