We're updating the issue view to help you get more done. 

HQL: Sql syntax exception when joining a Map<Entity,Component>

Description

The following HQL

1 select l from Line l join l.stuffs stfs where ?3 in (key(stfs)) and l.date=?1 and l.shift=?2

will generate the SQL Query

1 Hibernate: select line0_.id as id1_1_, line0_.date as date2_1_, line0_.leader_id as leader_i5_1_, line0_.line_type_id as line_typ6_1_, line0_.man_hours as man_hour3_1_, line0_.produce as produce4_1_, line0_.shift_id as shift_id7_1_, line0_.sku_id as sku_id8_1_ from line line0_ inner join line_stuffs stuffs1_ on line0_.id=stuffs1_.line_id cross join inner join stuffs stuff2_ on stuffs1_.stuffs_key=stuff2_.id inner join users stuff2_1_ on stuff2_.id=stuff2_1_.id where (? in (stuffs1_.stuffs_key)) and line0_.date=? and line0_.shift_id=?

which has syntax error.

1 Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inner join stuffs stuff2_ on stuffs1_.stuffs_key=stuff2_.id inner join users stu' at line 1

I've uploaded the test case

Environment

MySQL 5.7

Status

Assignee

Andrea Boriero

Reporter

unlimitedsola

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

5.1.0
5.0.9
5.2.1

Priority

Major