Evgeniy Khyst's Tech Blog
Articles on various software engineering topics
Follow @evgeniy-khist
· 61 min read

HHH-13740 - Problem with duplicates when fetching multiple many-to-many relations with Hibernate FetchMode.JOIN

HHH-13740 is an issue with duplicates, when multiple child collections are fetched using JOIN.

When entity has multiple many-to-many relations with FetchMode.JOIN (one of type List and others of type Set), searching for such entity Hibernate returns a result with a child relation of type List containing duplicates.

The bug can be reproduced on Hibernate 5.4.12.Final and OpenJDK 11.0.6 using both plain Hibernate API and Spring Data JPA 2.2.6.RELEASE.

The detailed description of the problem is available in the samples:

If you find this article helpful, please star it on GitHub