Unfortunately, that's the behavior of the criteria-based 2.x Linq provider.
The integrated Linq provider in 3.x works as expected.

   Diego


On Wed, May 12, 2010 at 12:40, Tim Scott <[email protected]>wrote:

> I have an NHibernate.Linq query with a predicate like this:
>
> foo => foo.Bar.Id == barId
>
> It generates SQL like this:
>
> ...FROM Foo this_
> left outer join Bar bar1_ on this_.BarID=bar1_.Id
> WHERE (bar1_.Id = 379)
>
> I was hoping it was clever enough to do it like this:
>
> ...FROM Foo this_
> WHERE (this_.BarId = 379)
>
> This query that will run every 5 seconds for all logged in users, so I
> need to cut all possible fat.  Is there some way to code this with
> Linq so that it skips the unnecessary join?  Keep in mind I do not
> have a handle on Bar entity, just the ID.
>
> --
> 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.
>
>

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