Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Expressions toString method serializes incorrectly #638
If you say A.a.id.eq(theId).and(B.b.on.eq(false).or(B.b.id.eq(otherId)));
then the generated condition for JPQL will be incorrect
the expected result is
based on bracketing rules, that would be evaluated like this:
my I'm seeing this bug by running a sort of "Does this problem handler deal with these problem causers?" function
which should return the problem causer if he matches the criteria, but if the problemSolver has a list of specific causers it handles, then it discriminates. Otherwise it catches everything.
the queries a little more complex, there are other filters at play but this is the basic problem. The generated clause is getting flattened out and evaluates incorrectly.
Did you look at the generated JPQL or the toString() result of the Expression? I created a test for it:
So it appears the toString() serialization should be tuned to take the operator precedence correctly into account, but the JPQL serialization works.
added a commit
Jan 24, 2014
huh. Maybe my complicated little query has a logical error, and the toString bug threw me off?
oh crud! I must have a bug somewhere else...
ok, so I guess the bug report is that the toString is misleading.