I have the following situation:
//--class user --
private ....
@OneToMany(targetEntity = UserRoles.class, mappedBy = \"iduser\", fetch = FetchType.LAZY)
@Js
For both classes you should have defined some ID property, we can use to identify objects in data base. We can use it to help Jackson to identify instances in runtime. You can remove @JsonBackReference and @JsonManagedReference and instead use com.fasterxml.jackson.annotation.JsonIdentityInfo annotation:
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "iduser")
class User {
...
}
and
@JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class,
property = "idgruppo")
class Gruppi {
...
}