将双向关联实现为两个单向关联会在创建表的DDL代码中有所不同。但是无论如何,我都可以使用书面的Java代码。因此,对象查询,更新和删除(如果有)的区别在哪里
@Entity
public class Employee {
@Id
private int Id;
@OneToOne
Address address;
}
@Entity
public class Address {
@Id
private int Id;
@OneToOne(mappedBy="address")
Employee employee;
}
b)
@Entity
public class Employee {
@Id
private int Id;
@OneToOne
Address address;
}
@Entity
public class Address {
@Id
private int Id;
@OneToOne
Employee employee;
}