I\'m trying to map a json (string format) to an object and I get the following error
com.fasterxml.jackson.databind.JsonMappingException: Multiple back-
I also faced this issue, but resolved it.
//This is parent class
@Entity
@Table(name = "checklist")
@JsonIgnoreProperties("inspection")
public class Checklist implements java.io.Serializable {
@ManyToOne
@JoinColumn(name = "product_id", referencedColumnName = "id")
@JsonBackReference
private Product product;
@OneToMany(mappedBy = "checklists", cascade = CascadeType.ALL)
@JsonManagedReference
private Set inspection = new HashSet();
//Constructor
//Getter and Setter
}
//This is child class
@Entity
@Table(name = "inspections")
public class Inspection {
@ManyToOne
@JoinColumn(name = "chk_id", referencedColumnName = "id")
private Checklist checklists;
//Constructor
//Getter and Setter
}
By mentioning @JsonIgnoreProperties("inspection")
and @JsonManagedReference
.
Resolved the issue raised by using two @JSONBackRefrence
in same parent class.