I fetch using EntityGraph with needed attributes. I have to create new endpoint to fetch data with all associates without making DTO.
Is it possible and if yes how can I do this?
@Query("SELECT e FROM Entity e")
@EntityGraph(value = "Entity.excludeAssociations", type = EntityGraph.EntityGraphType.LOAD)
Page\<Entity\> findAll(Pageable pageable);
@EntityGraph(
type = EntityGraph.EntityGraphType.FETCH,
attributePaths = {
"entityAddress",
"contactMethods",
"tags",
"entityUser"
}
)
Page<Entity> findAll(Specification<Entity> entitySpecification, Pageable pageable);