OK, here's a little update. I rewrote the code so now it looks like
this:

criteria.SetProjection(Projections.ProjectionList()
       .Add(Projections.GroupProperty("ID"))
       .Add//add other fields here

DetachedCriteria kittenCriteria= null;
kittenCriteria= criteria.CreateCriteria("Kitten",
JoinType.LeftOuterJoin);
kittenCriteria.AddOrder(new Order(Projections.Count("Cat.ID"),
ascending));

Now, this is sorta working. Sorta because I can see that it returns
what I need in the NHibernate Profiler (by the way, full respect for
people who made that, my life yesterday would have been a complete
misery without that little tool), BUT I get hit by an error because
this code returns a List<object[]> instead of List<Cat>. The silliest
thing is that the select statement from SQL that is sent to the server
is OK, only the column names are assigned aliases like y0_, y1_ and so
on. How do I tell NHibernate that I want to have objects of Cat type
instead of an object array?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to