I probably misunderstood some basics of JPA. I got a kind of circular reference on objects returned...
I had a list of questions, each with a list of responses. But with the JPA mapping i did, each response also have a question. See here :
@Entity
public class Question implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
// A question has several responses
@OneToMany(mappedBy = "question", fetch = FetchType.EAGER)
private List<Reponse> reponses;
@Entity
public class Reponse implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
protected Long id;
// This is here to specify the join column key "question_id"
@ManyToOne
@JoinColumn(name = "question_id")
private Question question;
As you see here, I have a question[0] which has a list of responses, but each has a question, which also have a list of responses and so on... :
How can i specify the join column key without having to bring the whole object and all his children and so on ?
Thank you very much for your help !
Joss