CLONE -Support new MySQL 5.0.12 join syntax

Description

http://dev.mysql.com/doc/refman/5.0/en/join.html

"Beginning with MySQL 5.0.12, natural joins and joins with USING, including outer join variants, are processed according to the SQL:2003 standard. These changes make MySQL more compliant with standard SQL. However, they can result in different output columns for some joins. Also, some queries that appeared to work correctly in older versions must be rewritten to comply with the standard. The following list provides more detail about several effects of the 5.0.12 change in join processing. The term "previously" means "prior to MySQL 5.0.12."

Using 5.0.18 and hibernate 3.1.2, hibernate is not producing the correct join syntax for the latest versions of mysql.

For example:

FROM tableA AS A, tableB AS B INNER JOIN tableC AS C ON A.field1 =
C.field2

The above fails, because the B JOIN C is evaluated before the A alias has
been created.

The solution is to use parentheses to force an order of evaluation:

FROM (tableA AS A, tableB AS B) INNER JOIN tableC AS C ON A.field1 =
C.field2

Environment

None

Activity

Show:
Peter Lundberg
December 6, 2006, 11:33 PM

My administrative mistake, I intended to clone the feature request and create a defect. Someone more senior in this jira will have to clean up. This issue could be deleted after considering my original

The issue is in my option not a new feature. We cannot use hibernate with mysql 5 with our mappings and hsql. When we upgrade to h3 from 2.1.6 we will verify further and if possible supply a testcase and perhaps a patch with h3, but this will be weeks or months away. In 2.1 we have a workaround where the "crossjoin" methods in JoinFragment classes are implemented using " JOIN " instead of ", ". This works with Mysql 5.0.24 but we have only tested for a day so far.

Steve Ebersole
March 21, 2011, 7:06 PM

Bulk closing stale resolved issues

Assignee

Diego Plentz

Reporter

Peter Lundberg

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure