NHibernate 2.2, .NET 2.0

I have two classes: TimeToEventGroupingDef and
TimeToEventGroupingTimePeriodDef.  Both of these classes have a
SortOrder property.

TimeToEventGroupingDef has a property, TimePeriods, which is an IList
of TimeToEventGroupingTimePeriodDef.

I'm trying a simple query to return all of the
TimeToEventGroupingTimePeriodDefs, ordered by the parent SortOrder,
then the child SortOrder, and project it into a DTO.



I'm creating/executing the query like this (sorry, VB):

Dim queryText As New StringBuilder("select p.GroupingDefId as
GroupingDefId, p.TimePeriodRange as Name, p.BinLengthLabel as
Description ")

queryText.Append(" from TimeToEventGroupingDef g join g.TimePeriods p
on g.GroupingDefId = p.GroupingDefId ")
queryText.Append(" where g.IsHidden = False ")
queryText.Append(" order by g.SortOrder asc, p.SortOrder asc ")

Dim qry As IQuery =
NHibernateHelper.GetCurrentSession().CreateQuery(queryText.ToString())
_
          
.SetResultTransformer(Transformers.AliasToBean(GetType(DTO.TimeToEventGroupingRow)))

Return qry.List(Of DTO.TimeToEventGroupingRow)()


When I execute this, I am not getting the results in any sort of
order.  When I use SQL Profiler to look at the generated SQL, there is
no ORDER BY clause.  I've tried simplifying the sort (single column)
and sorting on different columns.  Nothing.

What am I missing?

Thanks!

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to