我有以下表格架构。
Employee (id int primary key, addressId int);
Address (id int primary key, line1 varchar(99), line2 varchar(99));
和课程:
Employee {
int id;
Address address;}
Address {
String line1;
String line2;}
如何使用注释将OneToOne组件从Employee映射到地址?
答案 0 :(得分:0)
@Entity
public class Employee {
private int id;
@OneToOne
private Address address;
}
@Entity
public class Address {
private String line1;
private String line2;
}