Post

JPA - [Error] Querydsl No sources given

Caused by: java.lang.IllegalArgumentException: No sources given

Querydsl이 익숙치 않을때 개발을 하다보면 아주 가끔씩..? 볼 수 있는 에러이다.

1
2
3
4
5
6
7
8
return queryFactory
  .select(new QPushHistoryResDto(
    pushHistory.historySeq,
    pushHistory.readYn
  ))
  .where(pushHistory.acSeq.eq(acSeq))
  .orderBy(pushHistory.createdDate.desc())
  .fetch();

에러 원인을 잘 해석해보면.. 주어진 sources가 없다는 내용이다. 즉, Query문에 무언가 빠졌다는 내용이다.

잘 살펴보면 from절이 없다. from절을 추가해주면 된다…. 끝!

This post is licensed under CC BY 4.0 by the author.