4
I am with a Spring project, using JPA and liquibase, I have a bi-directional relationship between two entities, I wonder if anyone has a solution to the problem of infinite referencing between the two? Exemplifying I have a Question that has many Swers, an Swer has this Question that has this Swer and so it tends to infinity, I can not lose the bidirectionality then the Annotation @IgnoreJson
would not be interesting. Follows my entities.
@Entity
@Table(name = "question")
public class Question extends BasicForum{
private String title;
private Integer views;
@OneToMany(cascade= CascadeType.ALL, mappedBy = "question")
private List<Answer> answerList;
@Entity
@Table(name = "answer")
public class Answer extends BasicForum {
@ManyToOne(cascade = CascadeType.ALL)
private Question question;