Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds an explicit call to saveAndFlush within the updateOption method of OptionService. Feedback suggests removing this call because the method is already annotated with @transactional, allowing JPA's dirty checking to handle the persistence automatically, thus keeping the code cleaner.
Comment on lines
+85
to
86
| optionRepository.saveAndFlush(option); | ||
| return ResponseOptionDto.from(option); |
Contributor
There was a problem hiding this comment.
updateOption 메서드는 @Transactional 어노테이션이 적용되어 있어, JPA의 변경 감지(Dirty Checking) 기능에 의해 메서드 종료 시 변경 사항이 자동으로 데이터베이스에 반영됩니다. PR 제목에 언급된 '옵션Id 저장'과 관련하여, option 객체는 이미 ID를 가지고 있으며 영속성 컨텍스트에서 관리되고 있으므로 saveAndFlush를 명시적으로 호출하지 않아도 데이터베이스에 정상적으로 저장됩니다. 만약 Audit 필드(updatedAt 등)를 즉시 반영하여 응답 DTO에 포함해야 하는 특수한 상황이 아니라면, 이 라인을 제거하여 코드를 간결하게 유지하는 것을 권장합니다.
Suggested change
| optionRepository.saveAndFlush(option); | |
| return ResponseOptionDto.from(option); | |
| return ResponseOptionDto.from(option); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 PR 제목
🔗 관련 이슈
📌 작업 내용 요약
🧱 변경 범위 (Scope)
Backend
Frontend
🧪 테스트 내역
Backend
Frontend
npm run dev로컬 실행 확인테스트 상세(필수)
🖼️ 화면 캡처 / 시연 영상 (Frontend 변경 시 권장)
✅ 리뷰어 체크 포인트 (선택)