Hi everyOne,
when i try to get a list of object in "Societe" class
i'm getting this exception
LazyInitializationException] failed to lazily initialize a collection of role: com.protid.prosa.shared.model.bo.Commune.soumission, no session or session was closed
[INFO] org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.protid.prosa.shared.model.bo.Commune.soumission, no session or session was closed
Notice that the class
Societe have an attribute of type
Adresse. the adresse has an attribute
Commune . A set of "Soumission" are declared in
Commune class by the annotation OneToMany like this
@OneToMany(fetch = FetchType.LAZY, mappedBy="commune",targetEntity=com.protid.prosa.shared.model.bo.Soumission.class)
@Cascade(value = {CascadeType.ALL })
private Set<Soumission> soumission =new HashSet<Soumission>();
public Set<Soumission> getSoumission(){
return soumission;
}
}
i don't get where is the problem because i'm not looking for the "soumission " objects in the Commune class !!!
here is my rpc cal function
private void getCompany(){
SocieteServiceAsync rpc=clientFactory.getSocieteservicerpc();
AsyncCallback<List<Societe>> callback = new AsyncCallback<List<Societe>>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(List<Societe> result) {
if(result!=null){
societe=result.get(0);
result.get(0).getNomsociete();
}
}
};
rpc.list(callback);
}
Please help,
Thank you