-
Notifications
You must be signed in to change notification settings - Fork 2
โจ Join table with category #148
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
base: main
Are you sure you want to change the base?
Conversation
|
""" Walkthrough๋๊ธ๊ณผ ๊ด๋ จ๋ ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ํจ๊ป ์ฒ๋ฆฌํ๋๋ก DTO, ๋ ํฌ์งํ ๋ฆฌ, ์๋น์ค ๊ตฌํ์ด ํ์ฅ๋์์ต๋๋ค. ๋๊ธ ์๋ต DTO์ ์นดํ ๊ณ ๋ฆฌ ํ๋๊ฐ ์ถ๊ฐ๋๊ณ , ๋๊ธ๊ณผ ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ํจ๊ป ์กฐํ ๋ฐ ๋ฐํํ๋ ๋ก์ง์ด ๋์ ๋์์ต๋๋ค. JPQL LEFT JOIN ์ฟผ๋ฆฌ์ ๊ด๋ จ ๋ฉ์๋๊ฐ ์ถ๊ฐ๋์์ต๋๋ค. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant CommentServiceImpl
participant CommentRepository
participant CommentOfCategoryRepository
Client->>CommentServiceImpl: searchComments(์กฐ๊ฑด)
CommentServiceImpl->>CommentRepository: findCommentsWithCategoriesByCriteria(์กฐ๊ฑด)
CommentRepository-->>CommentServiceImpl: List<Object[]> (TbComment, TbCommentOfCategory)
loop ๊ฐ ๊ฒฐ๊ณผ์ ๋ํด
CommentServiceImpl->>CommentDto.Response: from(TbComment, TbCommentOfCategory)
end
CommentServiceImpl-->>Client: List<CommentDto.Response>
Poem
""" ๐ Recent review detailsConfiguration used: CodeRabbit UI ๐ Files selected for processing (1)
๐ง Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. ๐ชง TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 2
๐งน Nitpick comments (4)
src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java (4)
40-47: ์ฑ๋ฅ ์ต์ ํ๋ฅผ ์ํด JOIN ์ฟผ๋ฆฌ ์ฌ์ฉ์ ๊ณ ๋ คํด๋ณด์ธ์.ํ์ฌ ๊ตฌํ์ ๋๊ธ ์ ์ฅ ํ ๋ณ๋์ ์ฟผ๋ฆฌ๋ก ์นดํ ๊ณ ๋ฆฌ๋ฅผ ์กฐํํ๊ณ ์์ต๋๋ค. ์ด๋ ์ถ๊ฐ์ ์ธ ๋ฐ์ดํฐ๋ฒ ์ด์ค ํธ์ถ์ ๋ฐ์์ํต๋๋ค.
๋ ์ผ๊ด๋๊ณ ํจ์จ์ ์ธ ๋ฐฉ๋ฒ์ผ๋ก ๊ฐ์ ํ ์ ์์ต๋๋ค:
-// ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ํจ๊ป ๋ฐํํ๊ธฐ ์ํด ์นดํ ๊ณ ๋ฆฌ ์กฐํ -TbCommentOfCategory category = null; -if (savedComment.getCategoryId() != null) { - category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null); -} - -return CommentDto.Response.from(savedComment, category); +// JOIN ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํ์ฌ ๋๊ธ๊ณผ ์นดํ ๊ณ ๋ฆฌ๋ฅผ ํจ๊ป ์กฐํ +List<Object[]> result = commentRepository.findCommentsWithCategoriesByCriteria( + null, null, DELETED_STATUS_NO); +Object[] commentWithCategory = result.stream() + .filter(r -> ((TbComment) r[0]).getId().equals(savedComment.getId())) + .findFirst() + .orElse(new Object[]{savedComment, null}); + +TbComment comment = (TbComment) commentWithCategory[0]; +TbCommentOfCategory category = commentWithCategory.length > 1 ? + (TbCommentOfCategory) commentWithCategory[1] : null; + +return CommentDto.Response.from(comment, category);
61-68: create ๋ฉ์๋์ ๋์ผํ ์ฑ๋ฅ ์ต์ ํ ์ ์ฉ ํ์update ๋ฉ์๋๋ create ๋ฉ์๋์ ๋์ผํ ์ฑ๋ฅ ์ด์๊ฐ ์์ต๋๋ค. ๋ณ๋์ ์นดํ ๊ณ ๋ฆฌ ์กฐํ ๋์ JOIN ์ฟผ๋ฆฌ๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์ ๊ณ ๋ คํด๋ณด์ธ์.
40-47: ์ฑ๋ฅ ์ต์ ํ๋ฅผ ๊ณ ๋ คํด๋ณด์ธ์.ํ์ฌ ๋๊ธ ์ ์ฅ ํ ๋ณ๋์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ํธ์ถ๋ก ์นดํ ๊ณ ๋ฆฌ๋ฅผ ์กฐํํ๊ณ ์์ต๋๋ค. ์ด๋ ๋ถํ์ํ ์ถ๊ฐ ์ฟผ๋ฆฌ๋ฅผ ๋ฐ์์ํต๋๋ค.
๋ค์๊ณผ ๊ฐ์ด ๊ฐ์ ํ ์ ์์ต๋๋ค:
- // ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ํจ๊ป ๋ฐํํ๊ธฐ ์ํด ์นดํ ๊ณ ๋ฆฌ ์กฐํ - TbCommentOfCategory category = null; - if (savedComment.getCategoryId() != null) { - category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null); - } - - return CommentDto.Response.from(savedComment, category); + // ์นดํ ๊ณ ๋ฆฌ ID๊ฐ ์๋ ๊ฒฝ์ฐ์๋ง ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด์ ํจ๊ป ์กฐํํ๋ ๋ณ๋ ๋ฉ์๋ ์ฌ์ฉ ๊ณ ๋ ค + // ๋๋ ์์ฒญ ์์ ์ ์ด๋ฏธ ์ ํจํ ์นดํ ๊ณ ๋ฆฌ์ธ์ง ๊ฒ์ฆํ์ฌ ๋ถํ์ํ ์กฐํ ์ต์ํ + TbCommentOfCategory category = savedComment.getCategoryId() != null ? + commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null) : null; + + return CommentDto.Response.from(savedComment, category);
61-68: create ๋ฉ์๋์ ๋์ผํ ์ฑ๋ฅ ์ด์๊ฐ ์์ต๋๋ค.update ๋ฉ์๋์์๋ ๋ณ๋์ ๋ฐ์ดํฐ๋ฒ ์ด์ค ํธ์ถ๋ก ์นดํ ๊ณ ๋ฆฌ๋ฅผ ์กฐํํ๊ณ ์์ด ๋์ผํ ์ฑ๋ฅ ์ต์ ํ๊ฐ ํ์ํฉ๋๋ค.
๐ Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
๐ Files selected for processing (3)
src/main/java/com/handongapp/cms/dto/v1/CommentDto.java(3 hunks)src/main/java/com/handongapp/cms/repository/CommentRepository.java(1 hunks)src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java(5 hunks)
๐งฐ Additional context used
๐งฌ Code Graph Analysis (1)
src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java (1)
src/main/java/com/handongapp/cms/dto/v1/CommentDto.java (1)
CommentDto(11-129)
๐ Additional comments (10)
src/main/java/com/handongapp/cms/repository/CommentRepository.java (2)
30-44: ์๋ก์ด JOIN ์ฟผ๋ฆฌ ๋ฉ์๋ ๊ตฌํ์ด ์ ์ ํฉ๋๋ค.LEFT JOIN์ ์ฌ์ฉํ์ฌ ์นดํ ๊ณ ๋ฆฌ๊ฐ ์๋ ๋๊ธ๋ ์กฐํํ ์ ์๋๋ก ํ ์ค๊ณ๊ฐ ์ฌ๋ฐ๋ฆ ๋๋ค. ์ฟผ๋ฆฌ ๊ตฌ์กฐ์ ๋งค๊ฐ๋ณ์ ์ฒ๋ฆฌ๋ ๊ธฐ์กด ๋ฉ์๋์ ์ผ๊ด์ฑ ์๊ฒ ๊ตฌํ๋์์ต๋๋ค.
30-44: JPQL LEFT JOIN ์ฟผ๋ฆฌ๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌํ๋์์ต๋๋ค.LEFT JOIN์ ์ฌ์ฉํ์ฌ ์นดํ ๊ณ ๋ฆฌ๊ฐ ์๋ ๋๊ธ๋ ํฌํจํ๋๋ก ํ ์ค๊ณ๊ฐ ์ ์ ํ๋ฉฐ, ๋งค๊ฐ๋ณ์ ๋ฐ์ธ๋ฉ๊ณผ ์ ๋ ฌ ์กฐ๊ฑด๋ ์ ํํฉ๋๋ค.
src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java (3)
4-4: ์์กด์ฑ ์ฃผ์ ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ถ๊ฐ๋์์ต๋๋ค.
CommentOfCategoryRepository์์กด์ฑ ์ฃผ์ ๊ณผ import ๊ตฌ๋ฌธ์ด ์ ์ ํ๊ฒ ์ถ๊ฐ๋์์ต๋๋ค.Also applies to: 7-7, 29-29
106-116: JOIN ์ฟผ๋ฆฌ๋ฅผ ํ์ฉํ ํจ์จ์ ์ธ ๊ตฌํ
findCommentsWithCategoriesByCriteria๋ฉ์๋๋ฅผ ์ฌ์ฉํ์ฌ ํ ๋ฒ์ ์ฟผ๋ฆฌ๋ก ๋๊ธ๊ณผ ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ๋ชจ๋ ๊ฐ์ ธ์ค๋ ๊ตฌํ์ด ํจ์จ์ ์ ๋๋ค. Object[] ๋ฐฐ์ด ์ฒ๋ฆฌ ๋ก์ง๋ ์ ์ ํฉ๋๋ค.
4-4: ์นดํ ๊ณ ๋ฆฌ ์ ์ฅ์ ์์กด์ฑ์ด ์ฌ๋ฐ๋ฅด๊ฒ ์ถ๊ฐ๋์์ต๋๋ค.์๋ก์ด ๊ธฐ๋ฅ์ ์ํ CommentOfCategoryRepository ์์กด์ฑ ์ฃผ์ ์ด ์ ์ ํ๊ฒ ๊ตฌํ๋์์ต๋๋ค.
Also applies to: 7-7, 29-29
src/main/java/com/handongapp/cms/dto/v1/CommentDto.java (5)
4-4: DTO ๊ตฌ์กฐ ํ์ฅ์ด ์ ์ ํ๊ฒ ๊ตฌํ๋์์ต๋๋ค.์๋ก์ด ์นดํ ๊ณ ๋ฆฌ ํ๋๋ค์ด final๋ก ์ ์ธ๋์ด ๋ถ๋ณ์ฑ์ ๋ณด์ฅํ๊ณ , ์์ฑ์๋ ์ฌ๋ฐ๋ฅด๊ฒ ์ ๋ฐ์ดํธ๋์์ต๋๋ค. import ๋ฌธ๋ ์ ์ ํ ์ถ๊ฐ๋์์ต๋๋ค.
Also applies to: 27-29, 32-32, 40-42
45-82: ํฉํ ๋ฆฌ ๋ฉ์๋ ์ค๊ณ๊ฐ ์ฐ์ํฉ๋๋ค.๊ธฐ์กด
from(TbComment)๋ฉ์๋๋ฅผ ์ ์งํ์ฌ ํ์ ํธํ์ฑ์ ๋ณด์ฅํ๋ฉด์, ์๋ก์ดfrom(TbComment, TbCommentOfCategory)๋ฉ์๋๋ฅผ ์ถ๊ฐํ์ฌ ์ ์ฐ์ฑ์ ์ ๊ณตํ๋ ์ค๊ณ๊ฐ ํ๋ฅญํฉ๋๋ค. null ์ฒดํฌ๋ ์ ์ ํ๊ฒ ์ฒ๋ฆฌ๋์์ต๋๋ค.
4-4: ์นดํ ๊ณ ๋ฆฌ ํ๋๊ฐ ์ ์ ํ๊ฒ ์ถ๊ฐ๋์์ต๋๋ค.์๋ก์ด ์นดํ ๊ณ ๋ฆฌ ๊ด๋ จ ํ๋๋ค์ด ๋ถ๋ณ ํ๋๋ก ์ฌ๋ฐ๋ฅด๊ฒ ์ถ๊ฐ๋๊ณ ์์ฑ์๋ ์ ์ ํ ์ ๋ฐ์ดํธ๋์์ต๋๋ค.
Also applies to: 27-29, 40-42
32-32: ๊ธฐ์กด ํฉํ ๋ฆฌ ๋ฉ์๋์ ํ์ ํธํ์ฑ์ด ์ ์ง๋์์ต๋๋ค.๊ธฐ์กด
from(TbComment)๋ฉ์๋์์ ์๋ก์ด ์นดํ ๊ณ ๋ฆฌ ํ๋๋ค์ null๋ก ์ด๊ธฐํํ์ฌ ๊ธฐ์กด ์ฝ๋์์ ํธํ์ฑ์ ์ ์ ํ ์ ์งํ์ต๋๋ค.Also applies to: 57-61
64-81: ์๋ก์ด ํฉํ ๋ฆฌ ๋ฉ์๋๊ฐ ์ฌ๋ฐ๋ฅด๊ฒ ๊ตฌํ๋์์ต๋๋ค.null ์ฒดํฌ์ ์ผํญ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ์ฌ ์นดํ ๊ณ ๋ฆฌ ์ ๋ณด๊ฐ ์์ ๋๋ง ํด๋น ํ๋๋ฅผ ์ค์ ํ๋๋ก ์์ ํ๊ฒ ๊ตฌํ๋์์ต๋๋ค.
| TbCommentOfCategory category = null; | ||
| if (savedComment.getCategoryId() != null) { | ||
| category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(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.
๐ ๏ธ Refactor suggestion
์นดํ ๊ณ ๋ฆฌ ์กด์ฌ์ฑ ๊ฒ์ฆ ์ถ๊ฐ๋ฅผ ๊ณ ๋ คํด๋ณด์ธ์.
ํ์ฌ ๊ตฌํ์ categoryId๊ฐ ์กด์ฌํ์ง๋ง ํด๋น ์นดํ
๊ณ ๋ฆฌ๊ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์๋ ๊ฒฝ์ฐ๋ฅผ ์ฒ๋ฆฌํ์ง๋ง, ์ฌ์ฉ์์๊ฒ ๋ช
ํํ ํผ๋๋ฐฑ์ ์ ๊ณตํ์ง ์์ต๋๋ค.
์นดํ ๊ณ ๋ฆฌ๊ฐ ํ์์ธ ๊ฒฝ์ฐ ๊ฒ์ฆ ๋ก์ง์ ์ถ๊ฐํ ์ ์์ต๋๋ค:
// ์นดํ
๊ณ ๋ฆฌ ์ ๋ณด๋ฅผ ํจ๊ป ๋ฐํํ๊ธฐ ์ํด ์นดํ
๊ณ ๋ฆฌ ์กฐํ
TbCommentOfCategory category = null;
if (savedComment.getCategoryId() != null) {
- category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null);
+ category = commentOfCategoryRepository.findById(savedComment.getCategoryId())
+ .orElseThrow(() -> new NotFoundException("์ง์ ๋ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ID: " + savedComment.getCategoryId()));
}Also applies to: 63-66
๐ค Prompt for AI Agents
In src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java around
lines 42 to 45 and similarly at lines 63 to 66, the code fetches a category by
ID but does not handle the case where the category ID exists but the category is
not found in the database. Add validation to check if the category is null after
fetching; if the category is mandatory, throw an appropriate exception or return
a clear error message to inform the user that the category does not exist.
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.
@Callein, ์นดํ ๊ณ ๋ฆฌ ์กด์ฌ์ฑ ๊ฒ์ฆ์ ์ถ๊ฐํ๋ ์ฝ๋ ๋ณ๊ฒฝ์ ๊ณํํ๊ฒ ์ต๋๋ค.
graph TB
A["Task: ์นดํ
๊ณ ๋ฆฌ ์กด์ฌ์ฑ ๊ฒ์ฆ ์ถ๊ฐ"]
A --> B["create ๋ฉ์๋์ ์นดํ
๊ณ ๋ฆฌ ์กฐํ ๋ก์ง ์์ "]
A --> C["update ๋ฉ์๋์ ์นดํ
๊ณ ๋ฆฌ ์กฐํ ๋ก์ง ์์ "]
B --> D["orElse(null)์ orElseThrow()๋ก ๋ณ๊ฒฝ"]
C --> E["orElse(null)์ orElseThrow()๋ก ๋ณ๊ฒฝ"]
D --> F["NotFoundException์ผ๋ก ๋ช
ํํ ์๋ฌ ๋ฉ์์ง ์ ๊ณต"]
E --> G["NotFoundException์ผ๋ก ๋ช
ํํ ์๋ฌ ๋ฉ์์ง ์ ๊ณต"]
๋ค๋ฅธ ์์ด์ ํธ๊ฐ ์ด ๋ณ๊ฒฝ์ฌํญ๋ค์ ์ค์ ๋ก ๊ตฌํํ ์์ ์ ๋๋ค. ์ด ๋ณ๊ฒฝ์ผ๋ก ์นดํ ๊ณ ๋ฆฌ ID๊ฐ ์กด์ฌํ์ง๋ง ํด๋น ์นดํ ๊ณ ๋ฆฌ๊ฐ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์๋ ๊ฒฝ์ฐ ๋ช ํํ ์๋ฌ ๋ฉ์์ง์ ํจ๊ป ์์ธ๊ฐ ๋ฐ์ํ๊ฒ ๋ฉ๋๋ค.
โณ Preparing changes...
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.
A summary of the edits CodeRabbit can apply:
CommentServiceImpl.java์ create ๋ฐ update ๋ฉ์๋์ ์นดํ ๊ณ ๋ฆฌ ์กด์ฌ์ฑ ๊ฒ์ฆ ๋ก์ง์ด ์ถ๊ฐ๋ ์์ ์ ๋๋ค.
A plan of each step that CodeRabbit will take in order to execute the edits for each file (with inline rough draft snippets):
โ๏ธ src/main/java/com/handongapp/cms/service/impl/CommentServiceImpl.java
create ๋ฉ์๋ ๋ด๋ถ์์ ์นดํ
๊ณ ๋ฆฌ ์กฐํ ๋ถ๋ถ์ ์ฐพ์ต๋๋ค (๋๋ต 42~45ํ):
TbCommentOfCategory category = null; if (savedComment.getCategoryId() != null) { category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null); }
์ ์ฝ๋์์ orElse(null) ํธ์ถ์ ๋ค์๊ณผ ๊ฐ์ด ๊ต์ฒดํฉ๋๋ค. NotFoundException์ ๋์ ธ์ ์กด์ฌํ์ง ์๋ ์นดํ
๊ณ ๋ฆฌ์ ๋ํ ๋ช
ํํ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ ๊ณตํ๋๋ก ํฉ๋๋ค:
diff - category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(null); + category = commentOfCategoryRepository.findById(savedComment.getCategoryId()) + .orElseThrow(() -> new NotFoundException("์ง์ ๋ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ID: " + savedComment.getCategoryId()));
update ๋ฉ์๋ ๋ด๋ถ์์ ์นดํ
๊ณ ๋ฆฌ ์กฐํ ๋ถ๋ถ์ ์ฐพ์ต๋๋ค (๋๋ต 63~66ํ):
TbCommentOfCategory category = null; if (entity.getCategoryId() != null) { category = commentOfCategoryRepository.findById(entity.getCategoryId()).orElse(null); }
์ ์ฝ๋์์ orElse(null) ํธ์ถ์ ๋ค์๊ณผ ๊ฐ์ด ๊ต์ฒดํฉ๋๋ค. NotFoundException์ ๋์ ธ์ ์กด์ฌํ์ง ์๋ ์นดํ
๊ณ ๋ฆฌ์ ๋ํ ๋ช
ํํ ์ค๋ฅ ๋ฉ์์ง๋ฅผ ์ ๊ณตํ๋๋ก ํฉ๋๋ค:
diff - category = commentOfCategoryRepository.findById(entity.getCategoryId()).orElse(null); + category = commentOfCategoryRepository.findById(entity.getCategoryId()) + .orElseThrow(() -> new NotFoundException("์ง์ ๋ ์นดํ
๊ณ ๋ฆฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ID: " + entity.getCategoryId()));
ํ์ผ ์๋จ์ NotFoundException import๊ฐ ์๋์ง ํ์ธํฉ๋๋ค.
java import com.handongapp.cms.exception.data.NotFoundException;
๋๋ฝ๋์ด ์๋ค๋ฉด ์ถ๊ฐํฉ๋๋ค.
๋จ์ ํ ์คํธ๋ ํตํฉ ํ ์คํธ๋ฅผ ์คํํ์ฌ, categoryId๊ฐ ์กด์ฌํ์ง ์์ ๋ NotFoundException์ด ๋ฐ์ํ๋ฉฐ ๋ฉ์์ง๊ฐ ์ฌ๋ฐ๋ฅธ์ง ๊ฒ์ฆํฉ๋๋ค.
- โ Create PR with these edits
- ๐ Create commit in current branch
- ๐ Get copyable edits
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.
@Callein ์ด๊ฑฐ ๋ฐ์ดํฐ ์ค์์ ๋๊ธ์ ์๋๋ฐ ๋๊ธ ์นดํ ๊ณ ๋ฆฌ์ ํด๋นํ๋ ์นดํ ๊ณ ๋ฆฌ๊ฐ ์๋ ๋๊ธ์ด ํน์๋ ์๊ธฐ๋ ๊ฒฝ์ฐ์ ํด๋น ๋๊ธ์ ์ ์์ ์ผ๋ก ๋ณด์ ํ๊ธฐ ์ํด ์ผ๋ถ๋ก left join์ ์ฌ์ฉํ๋ฉด์ 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.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
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.
@junglesub ์ด๊ฑฐ ์ผ์ด์ค ์ด๋ป๊ฒ ํ ์ง ๋ด์ฃผ์ธ์
| TbCommentOfCategory category = null; | ||
| if (savedComment.getCategoryId() != null) { | ||
| category = commentOfCategoryRepository.findById(savedComment.getCategoryId()).orElse(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.
๋ฐ์ํด์ฃผ์ธ์
๐ ๊ด๋ จ ์ด์
Summary by CodeRabbit
์ ๊ท ๊ธฐ๋ฅ
๋ฒ๊ทธ ์์