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)

Activity

Show:

Vlad MihalceaMarch 22, 2017 at 2:27 PM

Applied PR upstream.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Created March 14, 2017 at 4:07 AM
Updated April 14, 2017 at 10:13 AM
Resolved March 22, 2017 at 2:27 PM

Flag notifications