[Spring Data JPA] 14. JPA 일대다 연관관계
ymkim
✔ 일대다 매핑을 이해하기 위한 다대일 양방향 매핑 위 사진을 보면 팀과 맴버가 다대일 양방향 관계이다. 현재는 Team도 members를 가지고 있고, Member 역시 team을 가지고 있다. 하지만 위와 같은 이유로 인해 아래 사진과 같은 연관관계 설계가 나올 수 있다. 일대다 단방향 매핑 관계 객체 입장에서 생각하면 충분히 나올 수 있는 설계다. Member 입장에서는 Team을 참조하지 않아도 되는 설계가 나올 수 있다. ✔ 일대다 단방향 매핑 위에서 본 관계와 비교하여 화살표 방향이 Team –> Member로 반대가 된것을 잘 봐야한다. 일대다 관계에서는 일(1)이 연관관계의 주인이다. 일(1) 쪽에서 외래키를 관리하겠다는 의미가 된다. 일대다 관계는 JPA 표준스펙에서는 지원을 하지만 실무..