0
I have the school entities and teacher. I mapped the Manytomany relationship. I have no idea how to save only the list by passing an array of ids.
Teacher class
@Id
Long id;
// não importa os demais atributos
Class School:
@Id
Long id;
@ManyToMany
@JoinTable(name = "school_x_teacher",
joinColumns = @JoinColumn(name = "id_school"),
inverseJoinColumns = @JoinColumn(name = "id_teacher"))
private List<Teacher> teacher;
I want send via Postman this:
[
{ "id": 1},
{ "id": 2},
{ "id": 3}
]
what directly in the bank, saving in the school with id = 1 would be:
INSERT INTO school_x_teacher VALUES (1,1), (1,2),(1,3);