Open zzozzolev opened 2 years ago
article -> profile user -> profile profile -> X
article -> user user -> profile
mappedBy
article -> profile profile -> user
문제
50 의 문제를 해결하기 위해서는 유저 인증 정보와 profile, article에서 참조하는 객체가 일치해야한다.
전제
해결
profile id로 user 객체를 가져옴
article에 profile이 아닌 user를 참조
profile도 마찬가지로 user가 필요함.->profile에서양방향 매핑시 Lazy 로딩 적용되지 않음mappedBy
로 유저 참조하면 해결됨.article에서 필요로 하는 정보는 user가 아닌 profile임. (username, image)-> article과 profile 영역이 나뉘어져 있으므로 별도의 API로 호출했을 가능성이 높음.profile에서 user를 참조