You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicinterfaceCommentRepositoryextendsJpaRepository<Comment, Long> {
@Query("select c from Comment c join fetch c.post where c.id = :comment")
Optional<Comment> findById(@Param("comment") Longid);
}
selectcomment0_.comment_idas comment_1_0_0_,
post1_.post_idas post_id1_2_1_,
comment0_.contentas content2_0_0_,
comment0_.post_idas post_id3_0_0_,
post1_.contentas content2_2_1_,
post1_.titleas title3_2_1_
from
comment comment0_
inner join
post post1_
oncomment0_.post_id=post1_.post_idwherecomment0_.comment_id=?
EntityGraph
attributePaths : 페치 조인할 속성을 설정한다.
EntityGraph.EntityGraphType
FETCH (Default) : 속성으로 지정된 것은 EAGER, 그 외에는 LAZY로 처리된다.
LOAD : 속성으로 지정된 것은 EAGER, 그 외에는 엔티티에서 지정된 값, 지정되지 않았다면 기본 FetchType으로 처리된다.