I need based on parameter retrieve or not some associations from an entity. In the bellow example I need to get the records list only if a parameter is passed through my api. Ca
How about using the base findById
to return just the Customer object and have another method findWithRecordsById
to return customer+records using @EntityGraph
?
public interface CustomerRepository extends JpaRepository<Customer, UUID>{
@EntityGraph(attributePaths = {"records"})
Customer findWithRecordsById(UUID id);
...
}