Have a problem that seems to be caused by a combination of hibernate-core 6 and FetchMode.SUBSELECT. Don’t get this problem with hibernate-core 5, or if I use FetchMode.SELECT or FetchMode.JOIN. Difficult to explain. Hopefully the test case on GitHub provides a suitable example: https://github.com/s-webber/hibernate-test-case-orm-6-subselect-children-not-retrieved Description: Have three entities - Parent, Child and GrandParent. Parent has @ManyToOne relationship on entity GrandParent. Parent has @OneToMany relationship on entity Child. Try to select from Parent where GrandParent is null (do this using query.where(criteriaBuilder.isNull(root.get("grandParent")))). Expect the Parent that is returned to be associated with 3 Child entities but is associated with none. See test case: https://github.com/s-webber/hibernate-test-case-orm-6-subselect-children-not-retrieved |