jpa/Hibernate
-
@ManyToOne(optional=false)/@JoinColumn(nullable=false)jpa/Hibernate 2023. 5. 28. 20:55
Team @Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor @Entity class Team { @Id private Integer id; private String name; @OneToMany(mappedBy = "team") private List member; } Member @Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor @Entity class Member { @Id private Integer id; private String name; @ManyToOne @JoinColumn(name = "team_id") private Team team; } 1. 기본 cre..