更新时间:2023-11-28 17:29:40
我认为问题可能出在Phone类的连接列注释中。您正在指定 employee_id
的连接列但是在Employee类中,id字段的 @Column
注释被映射到列 id
。
I think the issue may be in your join column annotation in the Phone class. You are specifying a join column of employee_id
yet in the Employee class the @Column
annotation for the id field is mapped to the column id
.
尝试更改/同步连接列:
Try changing/synchronizing the join columns:
@ManyToOne(fetch = FetchType.EAGER, targetEntity=your.package.here.Employee.class)
@JoinColumn(name = "id")
private Employee owner;
或
员工。 java
@Id
@Column(name = "employee_id", unique = true, nullable = false)
@GeneratedValue(strategy = javax.persistence.GenerationType.IDENTITY)
private Integer id;
Phone.java
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "employee_id", targetEntity=your.package.here.Employee.class)
private Employee owner;