Cześć,
próbuje dodać do bazy listę ale odpowiedzi ale dostaję błąd jak poniżej i nie wiem co robie źle
JSON parse error: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.ArrayList` out of START_OBJECT token\n at
@Data
@Entity
public class Questions {
@Id
@GeneratedValue
private Long id;
private String questions;
@OneToMany(fetch = FetchType.LAZY)
private List<Answer> answerList;
}
@Data
@Entity
public class Answer {
@Id
@GeneratedValue
private Long id;
private String answer;
private Long countAnswer;
@ManyToOne(cascade = { CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH} )
@JoinColumn(name="questions_id")
private Questions questions;
}
Postman: { "questions" : "Pytanie", "answerList" : { "answer": "Odpowieź", "countAnswer" : 1 } }