Closed as not planned
Description
Discussed in #69
Originally posted by dohorn July 15, 2022
First of all, I think this project is a super useful and necessary addition to Spring Data JPA 👍 What I would like to accomplish right now is to use this for nested projections on lazily loaded 1-To-Many Relations.
Doing this without any entity graph usually ends in a LazyInitializationException. However annotating the projection method with an entity graph solves this issue, like so:
public interface ProductDto {
String getName();
List<RatingDto> getRatings();
}
public interface RatingDto {
int getRating();
}
public interface BaseProductRepository<T extends AbstractProduct> extends Repository<T, String>, EntityGraphQuerydslPredicateExecutor<T> {
@EntityGraph(attributePaths = {"ratings"})
Optional<ProductDto> findById(String id);
}
As I want to do this in a dynamic way, this project would suit my purposes perfectly, if you decided to add support.