Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 4.2.0.Final, 4.3.0.Final, 5.0.0.Final, 5.1.0, 5.2.0
    • Fix Version/s: 5.2.8
    • Component/s: hibernate-core
    • Labels:
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      As mentioned in HHH-10537 Closed , The JPA spec contains examples of KEY() path dereferencing which is currently not allowed in Hibernate. This can be especially useful in cases where the map key is an entity since

      SELECT KEY(map) FROM ...
      

      would fetch the whole key but it might be desirable to select only a specific property of the key entity e.g.:

      SELECT KEY(map).name FROM ...
      

      Note that the selecting KEY(map).id is a special case for optimization since there is no need for an extra join in this case - the id can be selected from the join table.

      Attached is a test project that contains two basic tests, one for the id case and one for referencing a basic property. Further tests should also cover other types of paths like associations etc.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: