Skip to content
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

Merged
merged 2 commits into from
Mar 13, 2024

Conversation

dodunge
Copy link
Collaborator

@dodunge dodunge commented Mar 12, 2024

변경사항

AS-IS

  • 마이라운지에서 북마크한 그룹만 조회 api 작성 완료

TO-BE

  • 마이라운지 내 포스트 관리 api 작성

테스트

  • 테스트 코드
  • API 테스트

List<TripGroup> tripGroups = queryFactory
.select(qTripGroup)
.from(qTripGroup)
.join(qBookmark).on(qBookmark.tripGroup.eq(qTripGroup))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on() 사용하실때 Null 처리 안되어 있으면 NPE 뜨드라구요.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 감사합니다 확인하고 수정하도록 할게요!

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 어떤 조건에서 npe가 뜨는지 알 수 있을 까요??

Copy link
Collaborator

@eod940 eod940 Mar 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on으로 들어오는 파라미터가 null로 들어올경우 뜨더라구요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bookmark에 아무것도 없을 경우인가요??
제가 bookmark에 아무것도 없이 테스트 할 때에도 npe가 안뜨더라고요..ㅜㅜ
혹시 로그가 있을까요??

Copy link
Collaborator

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가 뜨더라구요. 아마 제가 뭔가 잘못 알고 있어서 그런 것 같습니다
확인해주셔서 감사합니다 😊

Copy link
Collaborator Author

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을 사용해서 조회하는게 더 좋을 것이라는 결론이 나와서 그 부분만 수정하도록 할게요!!
덕분에 좋은 정보 알게되었습니다!! 😊

Copy link
Collaborator

@eod940 eod940 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다!

@eod940 eod940 merged commit a215060 into ValueWith:master Mar 13, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants