我有一個推土機映射問題。問題是我想把我的實體的集合映射到我的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