강의

멘토링

커뮤니티

Inflearn Community Q&A

woojin1260767's profile image
woojin1260767

asked

Real-world! Spring Boot and JPA Utilization 2 - API Development and Performance Optimization

Order Lookup V3.1: Converting Entities to DTOs - Paging and Breaking Limits

안녕하세요!! v3.1 , v4 의 방식에서 의아한점이있는데욥

Written on

·

321

0

v3.1에서는 join fetch 를사용한 이유는 Order에대한 모든 객체그래프를 조회하기때문이고,

v4에서는 필요한 필드만 콕콕집어 조회를 해야하기때문에

join fetch를 사용하지 못하는건가요? 

join fetch는 모든 객체그래프를 끌어오는거니까요~?

v4
 return em.createQuery(
                "select new jpabook.jpashop.repository.order.query.OrderItemQueryDto " +
                        " ( oi.order.id, i.name, oi.orderPrice, oi.count  )" +
                        "from OrderItem oi " +
                        " join oi.item i " +
                        " where oi.order.id = :orderId ",OrderItemQueryDto.class)
        
v3.1

   return em.createQuery(
                " select o from Order o" +
                        " join fetch o.member m " +
                        " join fetch o.delivery d ", Order.class)
      

JPAjavaspringspring-boot

Answer 2

0

woojin126님의 프로필 이미지
woojin126
Questioner

감사합니다 

0

yh님의 프로필 이미지
yh
Instructor

안녕하세요. woojin126님^^

생각하신 내용이 맞습니다.

감사합니다.

woojin1260767's profile image
woojin1260767

asked

Ask a question