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

Return only distinct elements when query is hinted with EntityGraph

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 5.2.8
    • Fix Version/s: 5.2.10
    • Component/s: hibernate-core
    • Labels:
      None

      Description

      I came to an unwanted behavior of Hibernate while retrieving many to many relationship by fetch graph hinted hql. Hibernate executed left outer join query to retrieve that entity and thus returned duplicate results (reason).

      But my point is that there is a difference between user specifying Entity graph and manually executing HQL query with left joins.

      When user is explicitly executing left outer join, he might be aware of possibility of duplication, but this is not the case with entity graph. User might be unaware of this & he may rely on size() operation to get the count. Besides, entity graph contract only tells about properties to be fetched, so it should not modify the result set (especially the count of returned entities)

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: