Strange Jackson exception being thrown when serializing Hibernate object

前端 未结 15 2701
离开以前
离开以前 2020-11-29 18:12

Jackson is throwing a weird exception that I don\'t know how to fix. I\'m using Spring, Hibernate and Jackson.

I have already considered that lazy-loading is causing

15条回答
  •  [愿得一人]
    2020-11-29 19:07

    Similar to other answers, the problem for me was declaring a many-to-one column to do lazy fetching. Switching to eager fetching fixed the problem. Before:

    @ManyToOne(targetEntity = StatusCode.class, fetch = FetchType.LAZY)
    

    After:

    @ManyToOne(targetEntity = StatusCode.class, fetch = FetchType.EAGER)
    

提交回复
热议问题