Tuesday, June 11, 2013

Re: [LazyInitializationException] failed to lazily initialize a collection of role



Le mardi 11 juin 2013 13:26:45 UTC, Sahli Sabrina a écrit :
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

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment