I am trying to use HQL fetching my entity along with sub-entities using JOIN FETCH, this is working fine if I want all the results but it is not the case if I want a Page
Alternatively in newest versions of Spring (supporting JPA 2.1 specification) you can use entity graph like this:
@EntityGraph(attributePaths = "roles") @Query("FROM User user") Page findAllWithRoles(Pageable pageable);
Of course named entity graphs work as well.