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

[Issue] 매거진 댓글 작성자가 수정, 삭제를 못하는 에러 해결 #168

Conversation

Hoon9901
Copy link
Contributor

@Hoon9901 Hoon9901 commented May 15, 2024

📝 작업 내용

image

댓글 작성자인데 댓글 수정,삭제 시 요청이 처리가 되지 않는 문제를 해결했습니다.

문제되는 부분

image
isCommentAuthor 메서드는 두 객체의 참조값을 비교연산해 동일한 작성자인지를 체크하고 있었습니다.
하지만 MagazineComment의 Member 인스턴스는 실제로 LazyLoading 으로 인한 Proxy 객체 이므로 동일 비교 시 논리적으론 두 객체가 동일하지만 참조값이 달라서 문제가 발생했습니다.

따라서 이를 해결하기위해 equals 메서드를 재정의하였고 Primary Key 필드를 통해서 동등성 비교를 하도록 로직을 개선했습니다.

🦾 연관된 이슈

https://mediaxi.atlassian.net/browse/ART-188?atlOrigin=eyJpIjoiMzliOGZlMTZlNWZmNDdmNWE1NmZlYmYyMWM2YjE2OTUiLCJwIjoiaiJ9

💬리뷰 요구사항

- PrimaryKey 필드를 통해 객체 동등성 비교하도록 구현
- MagazineComment의 Member는 HibnerateProxy 객체이므로 동일성 검사 (==) 시 실패함
- 이를 해결하기 위해 equals를 통한 동등성 검사 수행
@Hoon9901 Hoon9901 added the bug Something isn't working label May 15, 2024
@Hoon9901 Hoon9901 requested a review from haroya01 May 15, 2024 08:44
@Hoon9901 Hoon9901 self-assigned this May 15, 2024
Copy link

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

@Hoon9901 Hoon9901 merged commit 5a0715a into develop May 15, 2024
3 checks passed
@Hoon9901 Hoon9901 deleted the ART-188-be-댓글-수정-삭제-시-동일-작성자-에러-해결 branch May 15, 2024 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants