-
Notifications
You must be signed in to change notification settings - Fork 1
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
유저 관련 연관 테이블의 영속성 전이를 수정해줬어요 #249
Conversation
@OneToOne(mappedBy = "profileImage", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(mappedBy = "pin", fetch = FetchType.LAZY) |
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.
매핑이 잘못되어있었고, 영속성 전이가 여기엔 필요가 없어서 지웠습니다 ~
@OneToOne(mappedBy = "profileImage", fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(mappedBy = "profileImage", fetch = FetchType.LAZY) |
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.
프로필 이미지에도 마찬가지여서 영속성 전이를 제외시켰습니다 ~
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) | ||
@JoinColumn(name = "profile_image_id") | ||
private ProfileImage profileImage; | ||
|
||
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) | ||
@JoinColumn(name = "pin_id") | ||
private Pin pin; | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) | ||
@OneToOne(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
private RefreshToken refreshToken; |
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.
프로필 이미지와, 핀은 유저가 생성될 때 같이 생성되게 PERSIST를 적용시켰고
리프레시토큰과 프로필이미지, 핀은 유저가 삭제될 때 다같이 삭제되어야 해서 REMOVE를 적용 시켜서
필요한것만 적용시켰습니다..
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.
좋습니다~!
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) | ||
private List<Link> linkList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) | ||
private List<UserHashtag> userHashtagList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) | ||
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) | ||
private List<Bookmark> bookmarkList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) | ||
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) | ||
private List<IsLinkRead> isLinkReadList = new ArrayList<>(); | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) | ||
@OneToMany(mappedBy = "user", cascade = CascadeType.REMOVE) |
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.
확인했습니다~
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) | ||
@JoinColumn(name = "profile_image_id") | ||
private ProfileImage profileImage; | ||
|
||
@OneToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) | ||
@OneToOne(fetch = FetchType.LAZY, cascade = {CascadeType.PERSIST, CascadeType.REMOVE}) | ||
@JoinColumn(name = "pin_id") | ||
private Pin pin; | ||
|
||
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL) | ||
@OneToOne(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) | ||
private RefreshToken refreshToken; |
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.
좋습니다~!
개요
유저 관련 연관 테이블의 영속성 전이를 수정해줬어요
📌 관련 이슈
✨ 과제 내용