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.
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] feature/#253 특정 핀에 대해 내 지도에 저장하기 API #270
[BE] feature/#253 특정 핀에 대해 내 지도에 저장하기 API #270
Changes from 13 commits
8646b1a
5b153cc
c54a142
1397964
4efef6e
c1fe514
4d7b389
e9d7017
1a596ca
1de1b01
62ba5f1
10df876
53ec9b4
8af79ae
b075d3a
b6e45e7
fd65611
8167a2c
573fc31
d49b632
dea2ee8
595bbb6
fd4ab32
a65cede
dadca50
c5a8553
eb86367
85e5e79
1347041
a887e37
c58e942
545dd37
0f07543
17648af
c1c0134
be05418
1fa892a
bc85d60
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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 를 정확히 모르는 것 같아서 여쭤봅니다.
copyPinsToTopic 메서드는
위와 같이 이루어져있어
사용자가 해당 핀들을 저장하고 싶은 토픽의 Pins 에는 저장이 되지만, 실질적으로 topic 을 save 하는 구문이 없어 cascade 로 인한 영속화가 진행되지 않을 것 같은데
맞을까요??
아니면 해당 토픽은 이미 영속화된 토픽이기 때문에 변경감지로 인해서 알아서 영속화가 진행이 되는 것일까용?
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.
네 변경감지와
CascadeType.PERSIST
로 인해서Pin
들도 자동으로 영속 상태로 만들어 집니다.Pin
을 복사할 때, 생성자에 포함된 연관관계 편의 메서드로 인해Topic
의List<Pin> pins
에 변화가 생깁니다.이러한
Topic
의 변화를 JPA가 트랜잭션 커밋 시점에서 감지합니다. (변경 감지)Topic
이 영속 상태로 만들어질 때,CascadeType.PERSIST
로 인해연관된
Pin
들도 함께 영속 상태로 만들어집니다.이로 인해 연관관계에 있는
Pin
들이 영속 상태로 만들어지면서, INSERT 쿼리가 실행시킵니다.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.
메서드 명을 아래와 같이 변경하는 것은 어떠신가요 ?
validatePinCreateOrUpdateAuthInTopic
처음 해당 메서드 명을 보고, '복사하고자 하는 핀의 수정 가능여부 검증'으로 오해했어요 !
필수 요청 사항은 아니므로, 준팍이 고민해보고 결정해주세용 ~
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.
반영했습니다