If a Customer has many Orders attached to them. How would you lazy load the Orders List using NHibernate.
Is it something that needs to be set up mapping file? any
All of the answers here are correct, but if there are so many Orders you migth also want to use filters, so that you don't have to load all of them.
Customer customer = session.CreateCriteria(...) .SetFetchMode("Orders", FetchMode.Lazy) .UniqueResult(); Ilist orders = session.CreateFilter(customer.Orders," WHERE this.OrderDate < ?") .SetDateTime(...).List();