Bonjour,

J'ai défini une relation avec LAZY

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
@ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.LAZY)
@JoinTable(name = "cours_eleve")
public Set<Cours> getCours() {
return cours;
	}
Lorsque je retourne l'objet et que je veux parcourir la liste, j'ai cette erreur.
An attempt was made to traverse a relationship using indirection that had a null Session.This often occurs when an entity with an uninstantiated LAZY relationship is serialized and that relationship is traversed after serialization.To avoid this issue, instantiate the LAZY relationship prior to serialization.
Comment je peux contourner ce problème en gardant l'attribut lazy ?

Merci