select t from Domain.Task t left join t.Holder h order by
h.Name<http://t.holder.name/> Desc,
t.Revision Asc

On Wed, May 5, 2010 at 10:12 AM, Daniel Kolman <[email protected]>wrote:

> Hi,
>
> recently we upgraded to NHibernate 2.1.2 GA. Since that time I'm
> having trouble with HQL query that worked perfectly in NHibernate 2.0:
>
> select t from Domain.Task t left join t.Holder order by t.Holder.Name
> Desc, t.Revision Asc
>
> Every Task object has property Holder of type User (many-to-one
> mapping). Task.Holder can be null. The query should list all Tasks,
> regardless whether they have or have not a Holder, and order them by
> Holder.Name property.
>
> In NHibernate 1.2 and 2.0 it generates correct SQL:
>
> select ...
> from TestDB.dbo.tblTask task0_
> left outer join TestDB.dbo.tblUser user1_ on task0_.
> [Holder_Id]=user1_.Id
> order by  user1_.[Name] Desc , task0_.[Revision] Asc
>
> But in NHibernate 2.1.2, it adds the user table again to the query,
> and adds WHERE clause that removes Tasks that has no Holder:
>
> select ...
> from TestDB.dbo.tblTask task0_
> left outer join TestDB.dbo.tblUser user1_ on task0_.
> [Holder_Id]=user1_.Id,
> TestDB.dbo.tblUser user2_
> where task0_.[Holder_Id]=user2_.Id
> order by user2_.[Name] Desc, task0_.[Revision] Asc
>
> Is there any workaround for this?
>
> Thanks for replies.
>
> --
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>


-- 
Fabio Maulo

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