Hey,
as of 0.8.4, the implementation of Criteria.CreateCriteria is missing. What I would like to achieve with is that I would want to sort the order the entities in a one-to-many relationship are outer joined.
The example code would be:
Code:
session.CreateCriteria(typeof(Parent))
.SetFetchMode("Children", FetchMode.Eager)
.CreateCriteria("Children")
.AddOrder(Order.Desc("Value"))
.List()
Maybe I would also have to call AddOrder for the root criteria so that the Parent object's rows stay together, such as:
Code:
session.CreateCriteria(typeof(Parent))
.AddOrder(Order.Asc("Id"))
.SetFetchMode("Children", FetchMode.Eager)
.CreateCriteria("Children")
.AddOrder(Order.Desc("Value"))
.List()
but this is just a minor detail.
Is there any other way to tell NHibernate how to sort the outer joined entities? Of course my relationship is mapped as lazy and it has the
order-by attribute but in this case, I'm eagerly loading it and that attribute is not taken into account here (afaik).
Thanks,
RGab