From: Krzysztof K. (J. <nh...@gm...> - 2011-05-16 02:32:47
|
subselect in LINQ query with Contains clause produces wrong SQL --------------------------------------------------------------- Key: NH-2706 URL: http://216.121.112.228/browse/NH-2706 Project: NHibernate Issue Type: Bug Components: Linq Provider Affects Versions: 3.1.0 Reporter: Krzysztof Koźmic Priority: Critical I was trying to execute the following query return (from foo in _session.Query<Foo>() where (from personBar in _session.Query<PersonBars>() where personBar.Person.Id == _personId select personBar.Bar).Contains(foo.Bar) orderby foo.FooNumber select new SomeProjection( foo.Id, foo.A, foo.B, foo.Bar.Id, foo.Bar.Description)).ToList(); basically the goal was to get all Foos with Bar that given user of the app has Bar for too. now the part of the SQL generated that has a bug in it looks kind of like this (sorry for obscuring it): where some clauses and (exists (select bar_.ID from PERSON_BAR pb joins to bar where some other clauses here and pb.ID = foo0_.BAR_ID)) Notice the last line which should say pb.BAR_ID = foo0.BAR_ID that's the bug. Hope that helps. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |