Linq query with Any operator creates wrong results
--------------------------------------------------
Key: NH-2649
URL: http://216.121.112.228/browse/NH-2649
Project: NHibernate
Issue Type: Bug
Components: Core, Linq Provider
Affects Versions: 3.2.0Alpha1, 3.1.0, 3.0.0.GA, 3.2.0Beta1
Reporter: Harald M. Müller
Priority: Critical
Attachments: LinqAnyNotOr.zip
Linq's .Any operator is apparently not translated to valid HQL. In the attachment, there are two test cases for an .Any behind a ! (not) and an .Any containing || (or):
p => !p.Children.Any(c => c.Ref1 != null && c.Ref1.Name == "R1A")
p => p.Children.Any(c => c.Ref1 != null && c.Ref1.Name == "R1A"
|| c.Ref2 != null && c.Ref2.Name == "R2A")
I argue that this bug is critical because
* the tests do *not* throw an exception, i.e., one might assume that the result is correct when it is not.
* Workarounds are hard - they need to rewrite the complete expression. Especially when the expressions are built algorithmically (e.g. depending on user input), this may be next to impossible.
I risk to predict that correctly translated HQL would then create wrong SQL - see issue NH-2648. Therefore, both these issues probably need to be solved at the same time.
--
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
|