我对推土机映射有疑问。问题是我应该将集合从我的实体映射到我的 DTO。
实体中的集合:
private List<Devis> devises = new ArrayList<Devis>(0);
@OneToMany(fetch = FetchType.LAZY, mappedBy = "idDemande")
public List<Devis> getDevises() {
return this.devises;
}
public void setDevises(List<Devis> devises) {
this.devises = devises;
}
在 DTO 中:
private List<DevisDto> devises = new ArrayList<DevisDto>();
public List<DevisDto> getDevises() {
return devises;
}
public void setDevises(List<DevisDto> devises) {
this.devises = devises;
}
错误 :
org.hibernate.LazyInitializationException: illegal access to loading collection
MapId: null
Type: null
Source parent class: com.bnpparibas.realestate.workflowtma.entity.Devis
Source field name: lignes
Source field type: class org.hibernate.collection.internal.PersistentBag
Source field value: Unable to determine source field value
Dest parent class: com.bnpparibas.realestate.workflowtma.dto.DevisDto
Dest field name: lignes
Dest field type: java.util.List