IDCard类里主键是
@Id
@EmbeddedId
private StudentPK studentPK;
Student类里IDCard的关联:
@OneToOne(cascade = CascadeType.ALL)
@JoinColumns(
{
@JoinColumn(name = "id"),
@JoinColumn(name = "sid")
}
)
private IDCard idCard;
@Id
@EmbeddedId
private StudentPK studentPK;
Student类里IDCard的关联:
@OneToOne(cascade = CascadeType.ALL)
@JoinColumns(
{
@JoinColumn(name = "id"),
@JoinColumn(name = "sid")
}
)
private IDCard idCard;
2018-05-15
FetchType.LAZY:懒加载,加载一个实体时,定义懒加载的属性不会马上从数据库中加载。
FetchType.EAGER:急加载,加载一个实体时,定义急加载的属性会立即从数据库中加载。
FetchType.EAGER:急加载,加载一个实体时,定义急加载的属性会立即从数据库中加载。
2018-04-06