728x90 반응형 다대다 관계1 다대다(ManyToMany) 관계 다대다(ManyToMany) 관계 @Entity public class Shop { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; @ManyToMany @JoinTable( name = "shop_brand", joinColumns = @JoinColumn(name = "shop_id"), inverseJoinColumns = @JoinColumn(name = "brand_id") ) private List brands; // Getter, Setter, Constructors, etc. } @Entity public class Brand { @Id @GeneratedValue(str.. 2024. 1. 19. 이전 1 다음 728x90 반응형