inblog logo
|
jay0628
    SpringBoot

    [Spring Boot] 45. 스프링부트 블로그 v2 (JPA) (15) 댓글 목록 2 - 게시글과 댓글의 양방향 매핑 (OneToMany)

    김주희's avatar
    김주희
    Apr 08, 2025
    [Spring Boot] 45. 스프링부트 블로그 v2 (JPA) (15) 댓글 목록 2 - 게시글과 댓글의 양방향 매핑 (OneToMany)
    Contents
    1. EAGER vs LAZY4. 최종

    1. EAGER vs LAZY

    1. DTO가 아닌 Entity에 List<Reply>

     
     

    2. EAGER

    notion image
    notion image
     

    3. LAZY

    notion image
    notion image
     

    4. 최종

    select b from Board b join fetch b.user left join fetch b.replies where b.id = :id
    notion image
     
     

    2. reply까지 join

    select b from Board b join fetch b.user left join fetch b.replies r join fetch r.user where b.id = :id
    notion image
    notion image
     

    3. 서버 실행 후 게시글 상세보기 화면을 들어가면

    notion image
    notion image
    Share article

    jay0628

    RSS·Powered by Inblog