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

Alias available in WITH clause although not defined yet and generates invalid SQL

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.2.7
    • Fix Version/s: None
    • Component/s: hibernate-core
    • Labels:
      None
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      In HHH-2772 Closed the check for non-driving table references got removed, but there are cases possible now that shouldn't be. The following HQL should fail

      FROM EntityA a
      JOIN EntityB b ON owner1 = a.owner
      JOIN b.owner owner 1
      

      but instead results in the following SQL

      SELECT ...
      FROM entity_table_a a
      JOIN entity_table_b  b ON owner_3 = a.owner_id
      JOIN owner_table owner_3 ...
      

      This SQL fails, but IMO Hibernate shouldn't even be able to compile the HQL.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                christian.beikov Christian Beikov
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: