-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat:[055-MYLOUNGE/BOOKMARK] 마이 라운지에서 북마크한 그룹만 조회 API 작성 #147
Conversation
List<TripGroup> tripGroups = queryFactory | ||
.select(qTripGroup) | ||
.from(qTripGroup) | ||
.join(qBookmark).on(qBookmark.tripGroup.eq(qTripGroup)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on() 사용하실때 Null 처리 안되어 있으면 NPE 뜨드라구요.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 감사합니다 확인하고 수정하도록 할게요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 어떤 조건에서 npe가 뜨는지 알 수 있을 까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on으로 들어오는 파라미터가 null로 들어올경우 뜨더라구요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bookmark에 아무것도 없을 경우인가요??
제가 bookmark에 아무것도 없이 테스트 할 때에도 npe가 안뜨더라고요..ㅜㅜ
혹시 로그가 있을까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 코드로 테스트를 해서 나온 결과는 아닙니다!! 수정님이 테스트 했을때 괜찮았으면 아마 해당 이슈는 없는 것 같습니다ㅎㅎ
제가 npe 말씀드린 이유는 아래 코드 작성하면서 on 관련한 npe가 발생해서 그랬습니다
...
return queryFactory
.selectFrom(qPost)
.leftJoin(qPost.tripGroup, qTripGroup)
.where(predicate).fetchJoin()
.orderBy(qPost.createdDateTime.desc())
.offset(pageable.getOffset())
.limit(pageable.getPageSize())
.fetch();
중간에 where(predicate) 가 on(predicate)였는데, predicate에서 null 처리를 해도 npe가 뜨더라구요. 아마 제가 뭔가 잘못 알고 있어서 그런 것 같습니다
확인해주셔서 감사합니다 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
아하 근데 저도 찾아보니까 대영님 말씀대로 .on부분에 null있으면 npe가 뜰 수도 있다고 하네요 ㅎㅎ
그래서 .join말고 .leftjoin을 사용해서 조회하는게 더 좋을 것이라는 결론이 나와서 그 부분만 수정하도록 할게요!!
덕분에 좋은 정보 알게되었습니다!! 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
확인했습니다!
변경사항
AS-IS
TO-BE
테스트