I know that stateless sessions do not support lazy loading. It seems like 
an unnecessary restriction to me, but that is another topic.

What would be a suitable approach to do on-demand loading of a child 
collection? For example, an Order object is loaded through a stateless 
session. Its OrderItems collection is not fetched, since whether that is 
needed or not is determined depending on a number of conditions. If the 
software needs the client collection later on, what call could it make to 
populate Order.OrderItems? Would it be something like:

order = statelessSession.Get<Order>(12345);
...
order.OrderItems = 
statelessSession.CreateCriteria<OrderItems>()....[something to get a list 
of all orderitems for order 12345].....?

To be clear: eager loading the child collection is not an option, since in 
many cases it is not needed. 

(If you wonder why I want a stateless session, then it is because it seems 
to be the only way to make sure updates to tables are generated in the 
correct order - Order first, then OrderItem. See my other post(s) and the 
deadlock issues around this).

J.-

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/zhuW7aVSLwMJ.
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.

Reply via email to