We're updating the issue view to help you get more done. 

Return only distinct elements when query is hinted with EntityGraph

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)

Environment

None

Status

Assignee

Vlad Mihalcea

Reporter

Harsh Panchal

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

backportDecision

None

Components

Affects versions

5.2.8

Priority

Minor