Service Rerst déserialize json
J'ai un service rest pour faire un update et j'ai une erreur sur la dé-sérialisation.
My error : 2018-12-19 23:05:34.891 WARN 1432 --- [io-8080-exec-31] .c.j.MappingJackson2HttpMessageConverter : Failed to evaluate Jackson deserialization for type [[simple type, class fr.model.Utilisateur]]: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Cannot handle managed/back reference 'defaultReference': back reference type (java.util.List) not compatible with managed type (fr.model.Menu)
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
public class Utilisateur implements Serializable {
private static final long serialVersionUID = 1L;
@Id)
private Integer id;
@ManyToMany
@JoinTable(name = "utilisateurProfil", joinColumns = @JoinColumn(name = "idUtilisateur"), inverseJoinColumns = @JoinColumn(name = "idProfil"))
private List<Profil> profils = new ArrayList<Profil>();
GETTER / SETTER
}
public class Profil implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
@JsonManagedReference
@ManyToMany
@JoinTable(name="profilMenu",
joinColumns=@JoinColumn(name="idProfil"),
inverseJoinColumns=@JoinColumn(name="idMenu")
)
private List<Menu> menu = new ArrayList<Menu>();
GETTER / SETTER
}
public class Menu implements Serializable {
private static final long serialVersionUID = 1L;
@Id
private Integer id;
//bi-directional many-to-many association to Profil
@JsonBackReference
@ManyToMany
@JoinTable(name="profilMenu",
joinColumns=@JoinColumn(name="idMenu"),
inverseJoinColumns=@JoinColumn(name="idProfil")
)
private List<Profil> profils = new ArrayList<Profil>();
} |