JAVA-072 / Intermediate
N+1 queries and excessive exposure through JPA lazy relationships
Why is this a problem?
List requests trigger excessive queries and return unintended fields.
How to fix it
java
@OneToMany(fetch = FetchType.LAZY) List<Order> orders;
@EntityGraph(attributePaths = "orders") List<User> findAllWithOrders();