I have below entities:
public class Category { private Integer id; @OneToMany(mappedBy = "parent")
A workaround is to use @Query and @EntityGraph together, like it mentioned here use @Query and @EntityGraph together