inblog logo
|
taker
    스프링부트

    스프링 블로그

    JPQL 문 사용
    김인범's avatar
    김인범
    Jan 18, 2025
    스프링 블로그
    JPQL 문 사용
    notion image
    notion image
     
    sql문에서
    ※ fetch를 사용하지 않을 경우 select b from Board b join b.user where b.id=:id
    userId 만 가져오게 됩니다. (user객체 정보는 null값으로 처리됨)
     
    ※ fetch를 사용할 경우 select b from Board b join fetch b.user where b.id=:id
    DB를 두번 조회하지 않음 (자원절약)
    한번에 조회한 board객체와 관련된 user객체의 정보까지 가져올 수 있습니다.
     
    Share article

    taker

    RSS·Powered by Inblog