-
Notifications
You must be signed in to change notification settings - Fork 2
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
[BE] 리뷰 목록 카테고리 조회 시 네이티브 쿼리를 사용하도록 변경 #344
[BE] 리뷰 목록 카테고리 조회 시 네이티브 쿼리를 사용하도록 변경 #344
Conversation
Test Results58 tests 58 ✅ 2s ⏱️ Results for commit f4119f3. ♻️ This comment has been updated with latest results. |
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.
아자아자!
WHERE ca.review_id = :reviewId | ||
AND o.option_type = :#{#optionType.name()} | ||
""", nativeQuery = true) | ||
List<OptionItem> findByOptionTypeAndReviewId(long reviewId, OptionType optionType); |
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.
메서드 언급 순서와 파라미터 순서를 일치시켜주세요 (review가 더 앞에 오는 게 좋겠네요~)
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.
쿼리 굿 ! Inner join과 Left join, Outer join과도 비교해보고 어떤 걸 쓰는 것이 성능 상 이점이 있는지도 공부해보면 좋아요
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.
아하 교집합만 필요한 경우니 inner join을 적용해봐도 좋겠네요!
@@ -170,26 +168,13 @@ public ReceivedReviewsResponse2 findReceivedReviews2(String groupAccessCode) { | |||
} | |||
|
|||
private ReceivedReviewResponse2 createReceivedReviewResponse2(Review2 review) { |
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.
역시 JPA를 쓸 거면 확실히 쓰는게 좋군요😂
@@ -77,4 +96,47 @@ class OptionItemRepositoryTest { | |||
assertThat(actual).extracting(OptionItem::getId).containsExactly(optionId3, optionId1); | |||
} | |||
|
|||
@Test | |||
void 리뷰_아이디와_옵션_타입으로_선택한_옵션_아이템을_불러온다() { |
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.
엇 저는 성공합니다! DataJpaTest로 롤백은 되는데 이미 증가한 id는 다시 초기화 되지 않는 현상이 있습니다.
하지만 각 객체에서 getId() 방식으로 값을 불러다 쓰기 때문에 테스트에 영향은 없도록 테스트 로직을 짰습니다!
🚀 어떤 기능을 구현했나요 ?
🔥 어떻게 해결했나요 ?
📝 어떤 부분에 집중해서 리뷰해야 할까요?
📚 참고 자료, 할 말