Infinite Recursion with Jackson JSON and Hibernate JPA issue

前端 未结 25 3134
你的背包
你的背包 2020-11-21 07:31

When trying to convert a JPA object that has a bi-directional association into JSON, I keep getting

org.codehaus.jackson.map.JsonMappingException: Infinite          


        
25条回答
  •  粉色の甜心
    2020-11-21 07:49

    This worked perfectly fine for me. Add the annotation @JsonIgnore on the child class where you mention the reference to the parent class.

    @ManyToOne
    @JoinColumn(name = "ID", nullable = false, updatable = false)
    @JsonIgnore
    private Member member;
    

提交回复
热议问题