我无法确定类型:java.util.Set,在表:employee,对于列:[org.hibernate.mapping.Column(employeeAddresses)]。所以我有两个实体,比如
员工:
EMPLOYEE_ID(PK), 员工姓名, employee_type(FK),
EmployeeAddress:
employee_address_id, land_no, 手机号码, address_type(fk), employee_id(fk)
当我尝试应用一对多和多对一关联时。我超越了异常。
答案 0 :(得分:0)
你必须从Emoloyee实体写下你的onetomany关系,并从Employee Address实体反写映射
class Employee
{
@Id
private employee_id;
private String employee_name;
@OneToMany(mappedBy="department")
private Set<EmployeeAddres> employeeAddress;
}
和员工地址实体
class EmployeeAddres
{
// add your other attributes (don't put employee_id attribute)
@ManyToOne
@JoinColumn(name="employee_id")
private Employee employee;
}