Recursive JSON view of an entity with one-to-many relationship in REST controller

前端 未结 3 809
失恋的感觉
失恋的感觉 2020-12-31 19:25

I\'m using SpringBoot and JPA to build a REST interface.

Now, I have a strange JSON returned for the list of products fetched from the database. Let\'s say that I h

3条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-31 19:46

    Adding @JsonIgnore worked for me

    @OneToMany(mappedBy = "policy")
    @JsonIgnore
    private List payments;
    

    @JeanValjean your are the best

提交回复
热议问题