해결됨
실전! 스프링 부트와 JPA 활용2 - API 개발과 성능 최적화
컬렉션 조회
강의에서 order에 orderItemQuerydto를 컬렉션 하였는데
만약 예를들어
orderItemQuerydto에 itemDto라는 컬렉션까지 한번에 조회 하려고 할 때
강의에서 나온 동일한 방법을 반복하면 최적화가 될까요?
import com.jpahop2.demo.domain.Address;import com.jpahop2.demo.domain.OrderStatus;import lombok.Data;import java.time.LocalDateTime;import java.util.List;@Datapublic class OrderQueryDto { private Long orderId; private String name; private LocalDateTime orderDate; //주문시간 private OrderStatus orderStatus; private Address address; private List<OrderItemQueryDto> orderItems; public OrderQueryDto(Long orderId, String name, LocalDateTime orderDate, OrderStatus orderStatus, Address address) { this.orderId = orderId; this.name = name; this.orderDate = orderDate; this.orderStatus = orderStatus; this.address = address; }}
import lombok.Data;import java.time.LocalDateTime;@Datapublic class OrderItemQueryDto { private Long orderId; private int orderPirce; private int count; private String itemName; private List<ItemDto>items; public OrderItemQueryDto(Long orderId, int orderPirce, int count,String itemName) { this.orderId = orderId; this.orderPirce = orderPirce; this.count = count; this.itemName=itemName; }}