I'm learning Spring Boot Rest and with a question I can not solve on my own, could you help me?
I created the following mapping between the Launch and Person entities:
Person Entity:
@Entity
public class Pessoa {
...
@JsonIgnore
@OneToMany(mappedBy="pessoa")
private List<Lancamento> lancamentos;
//getters setters
}
Entity Launch:
@Entity
@Table(name="lancamento")
public class Lancamento {
...
@NotNull
@ManyToOne
@JoinColumn(name="id_pessoa")
private Pessoa pessoa;
//getters setters
}
Expected Result:
{
"nome":"Pessoa1",
lancamentos:[
{
"id":"1",
"descricao":"Educacao"
},
{
"id":"2",
"descricao":"Alimentacao"
},
]
}
Result Obtained:
{
"nome":"Pessoa1"
}
What am I doing wrong?