I'm learnig Spring boot Rest but I can't resolve a problem. Can someone help me? I created the following mapping between the Product and Category entities:
Category Entity:
@Entity
public class Category {
...
@JsonIgnore
@OneToMany(mappedBy="category")
private List<Product> products;
//getters setters
}
Product Entity:
@Entity
@Table(name="lancamento")
public class Lancamento {
...
@NotNull
@ManyToOne
@JoinColumn(name="id_pessoa")
private Pessoa pessoa;
//getters setters
}
I wait for this result:
{
"name":"Category_1",
"products":[
{
"id":"1",
"name":"Product_1"
},
{
"id":"2",
"name":"Product_2"
},
]
}
But the real result is:
{
"name":"Category_1"
}
What is wrong? Is there some settings that I need to make? Thanks.