休眠:一对一延迟加载,可选= false
我遇到了一个问题,即一对一的延迟加载在休眠状态下不起作用。我已经解决了它,但是仍然无法正确理解会发生什么。 我的代码(延迟加载在这里不起作用,当我拉人时-地址也被获取): @Entity public class Person{ @Id @SequenceGenerator(name = "person_sequence", sequenceName = "sq_person") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "person_sequence") @Column(name = "id") private long personID; @OneToOne(mappedBy="person", cascade=CascadeType.ALL, fetch = FetchType.LAZY) private Adress address; //.. getters, setters } @Entity public class Address { @Id @Column(name="id", unique=true, nullable=false) @GeneratedValue(generator="gen") @GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", …