NonUniqueResultException when attempting to fetch bidrectional OneToMany child collection in a DTO with join fetch

Since Hibernate 6 duplicate entity results are automatically removed in memory. This is not the case, however, for dynamic instantiation queries like the one you’re using in your OrderDTO example, and since you’re using getSingleResult() you get the non-unique result exception.

I would suggest using the entity query instead and instantiating the DTO objects programmatically to take advantage of automatic removal of duplicated results in your case.