Thx Richard,
here is: http://216.121.112.228/browse/NH-2493

On 6 Sty, 12:18, "Richard Brown \(gmail\)" <[email protected]>
wrote:
> Hi Kamil,
>
> That looks like a bug to me ... could you raise a JIRA?
>
> Cheers,
>     Richard
>
> -----Original Message-----
> From: kamil.kliczbor
> Sent: Wednesday, January 05, 2011 10:51 PM
> To: nhusers
> Subject: [nhusers] QueryOver OrderByAlias doesn't sort as expected
>
> Hello everyone,
>
> I cannot use the OrderByAlias / ThenByAlias method in QueryOver query.
> When I use
> this.Session.QueryOver<Product>()
>                 .OrderBy(x => x.Name).Desc
>                 .JoinQueryOver(x => x.Category, () => categoryAlias)
>                 .OrderBy(x => x.Name).Asc
>                 .List<Product>();
>
> It produces the right SQL:
> SELECT   this_.ProductId           as ProductId6_1_,
>          this_.ProductName         as ProductN2_6_1_,
>        ...
>          categoryal1_.Description  as Descript3_5_0_
>        ...
> FROM     Products this_
>          inner join Categories categoryal1_
>            on this_.CategoryId = categoryal1_.CategoryId
> ORDER BY this_.ProductName desc,
>          categoryal1_.CategoryName asc
>
> But when I try to write this query in other way - like this:
> this.Session.QueryOver<Product>()
>                 .JoinAlias(x => x.Category, () => categoryAlias)
>                 .OrderBy(x => x.Name).Desc
>                 .ThenByAlias(() => categoryAlias.Name).Asc
>                 //.OrderByAlias(() => categoryAlias.Name).Asc
>                 .List<Product>();
>
> it produces wrong SQL (insted of category name it orders ascending by
> product name ):
> SELECT ... FROM Products this_ inner join Categories categoryal1_ on
> this_.CategoryId=categoryal1_.CategoryId ORDER BY this_.ProductName
> desc, this_.ProductName asc
>
> Did I missed something ?
>
> --
> 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 
> athttp://groups.google.com/group/nhusers?hl=en.

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