【发布时间】:2020-02-29 09:59:58
【问题描述】:
Resolved [org.springframework.orm.jpa.JpaSystemException: attempted to assign id from null one-to-one property [com.example.bootapp.entity.Employee.user]; nested exception is org.hibernate.id.IdentifierGenerationException: attempted to assign id from null one-to-one property [com.example.bootapp.entity.Employee.user]]
用户实体
@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
@JoinColumn(name = "id")
@JsonIgnore
@Getter @Setter
private Employee employee;
员工实体
@OneToOne(fetch = FetchType.LAZY)
@MapsId
@JsonIgnore
private User user;
提前致谢!
【问题讨论】:
标签: mysql spring hibernate jpa one-to-one