Hi Fabio, Thanks for the response, but aren't those two statements are identical? (as the LINQ query is just syntactic sugar for the direct method calls?) I've just double checked and I'm getting the same SQL being executed. (that is, a left join against the referenced table's primary key, instead of just using the foreign key in the table we're querying?). I've tried messing around setting Lazy Load settings too, but doesn't seem to make a difference (and it defaults to on, anyway...)
Am I missing something really straightforward? Would you expect to see this behaviour normally? All the best James 2009/8/31 Fabio Maulo <[email protected]> > from Something t where t.Author.id = 29 > > 2009/8/31 James Crowley <[email protected]> > > Hey, >> I've noticed that if I write a query that puts a condition on a related >> entity's primary key, such as >> >> _queryService.IndexedUrl.Where(t=>t.Author.Id == 29) >> >> then nHibernate will join on the Author table, even though it only >> actually needs to specify "AuthorId" on the IndexedUrl table as we're not >> returning any rows from the related Author entity. Unfortunately it doesn't >> look like the database query optimizers realise this either. Is there any >> way I can force nHibernate to do the "right" thing? >> >> Thanks! >> >> James >> >> >> > > > -- > 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 -~----------~----~----~----~------~----~------~--~---
