地址与以下人员具有多对一的关系:
人 :
@Id
@Column(name="personid")
private Long personId;
private String firstName;
private String lastName;
private String email;
@OneToMany(cascade = CascadeType.ALL,mappedBy="person",targetEntity=Address.class,fetch=FetchType.LAZY)
private List addressArray=new ArrayList<>();
public Person() {
}
和地址:
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name="personId")
private Person person;
我想从“address.person.firstname”之类的地址对象访问人的名字,但它总是急切地加载这个人?