Hibernate多对一部分复合外键

时间:2018-01-03 13:32:17

标签: hibernate many-to-one

我有必须将部分复合键映射为外键的情况,例如,hibernate是否可以将部分复合键映射为外键?

class Employee {
    @embededId
    EmployeeId id;
}

class Mobile {
    @Id
    int mobId;

    @ManyToOne
    @JoinColumn(name="empId" referencecolumnname="empId")
    Employee emp;
}

class EmployeeId {
    private int empId;
    private int deptId;
}

0 个答案:

没有答案