QueryDsl에서 다음과 같이 fetchJoin()을 사용하여 코드를 작성하였더니 다음과 같은 에러가 발생했다.
코드
public List<A> findOne( {
return queryFactory
.selectFrom(QA.a)
.join(QA.a.b, QB.b).fetchJoin()
.join(QA.a.b.c, QC.c).fetchJoin()
.fetch();
}
에러
query specified join fetching, but the owner of the fetched association was not present in the select list
public List<A> findOne( {
return queryFactory
.selectFrom(QA.a)
.join(QA.a.b, QB.b).fetchJoin()
.join(QB.b.c, QC.c).fetchJoin()
.fetch();
}
참고
https://www.inflearn.com/questions/240949/fetchjoin-%EC%97%90%EB%9F%AC-%EB%B0%9C%EC%83%9D