HQL: Sql syntax exception when joining a Map<Entity,Component>
The following HQL
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
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.
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