Yours, I have the following doubt. I have an application in Rest that when I ask to return the list, it comes with many unnecessary fields, "example below". How do I select the attributes of the entity class that it should return?
My get:
@GetMapping
public List<Nota> listNotas(){
return notaRepository.findAll();
}
When I give a get I get the following return.
{
"id": 28,
"nota": 10,
"dataNota": [
2017,
10,
10
],
"professor": {
"id": 1,
"nome": null,
"matricula": null,
"observacao": null,
"dataNascimento": null,
"ativo": null
},
"materia": {
"id": 1,
"nome": null
},
"aluno": {
"id": 1,
"nome": null,
"matricula": null,
"observacao": null,
"dataNascimento": null,
"ativo": null,
"nomeResponsavel": null,
"foneResponsavel": null
}
}
I would like it to return with fewer fields such as
{
"id": 28,
"nota": 10,
"dataNota": [
2017,
10,
10
],
"professor": {
"id": 1,
"nome": null,
},
"materia": {
"id": 1,
"nome": null
},
"aluno": {
"id": 1,
"nome": null,
"matricula": null,
}
}