Uploaded image for project: 'Hibernate ORM'
  1. Hibernate ORM
  2. HHH-10919

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.1.0, 5.0.9, 5.2.1
    • Fix Version/s: 5.2.2, 5.1.5
    • Labels:
      None
    • Environment:
      MySQL 5.7
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      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
      

      I've uploaded the test case

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: