부모 엔티티 ⬇️
public class Product {
...
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "counselor_id", nullable = false,
columnDefinition = "BIGINT UNSIGNED COMMENT '수업 담당 전문가 PK'")
private Counselor counselor;
...
}
자식 엔티티 ⬇️
public class Counselor {
@Id
@Column(columnDefinition = "BIGINT COMMENT '전문가 PK'")
private BigInteger id;
....
}
부모 엔티티에는 UNSIGNED 옵션을 주었는데 자식 테이블 PK에는 주지 않아서 발생했다!
mysql에서UNSIGNED는 음수로 저장되면 안되는 필드에 걸어주는 옵션입니다.