Affects Version/s: 3.5.0-Beta-2, 3.5.0-Beta-3, 3.5.0-Beta-4, 3.5.0-CR-1, 3.5.0-CR-2, 3.5.0-Final, 3.5.1, 3.5.2, 3.5.3, 3.6.0
Fix Version/s: antlr-rework
Ms SQL Server 2005
Bug Testcase Reminder (view):
Last commented by a user?:true
There was a new feature implemented in 3.5.0-Beta-2:
, as a result, for many dialects, the comma operator "," was replaced with "cross join". As it's already obvious from the feature's description, this changes join precedence. If the query contains outer joins (left or right) this replacement changes the results (because outer join precedence is important).
This might not be interpreted as a bug if you know what SQL operator will be generated when you place a comma in HQL, but it's misleading if you don't. A HQL query like:
is not equivalent with the SQL query:
because the actual SQL query is:
The first SQL query would make a left join on B and C and then a cross join with the result and A (and this is what we should expect). The second SQL query makes a cross join on A and B and then a left join with the result and C (this is not expected since we had a comma in HQL).
I understand the issues presented in HHH-1480 Closed , but they should be expected, i.e. a developer SHOULD expect a faliure from a query like
because "a" is not visible in the join. Hibernate should not use a cross join behind the scenes to allow such a query at the expense of providing misleading results for others.
Maybe turn this into a feature/improvement or add another to allow explicit comma or croos join in HQL, or support parenthesis in HQL.
The only workaround I can see for now is to re-order the query like this: