JAXB A cycle is detected in the object graph

后端 未结 4 809
说谎
说谎 2020-12-19 11:59

I want to convert my pojo to json with JAXB, my pojo have one to many relation, and when i convert my pojo to json, JAXB generate error \"A cycle is detected in the object g

4条回答
  •  北海茫月
    2020-12-19 12:27

    As you mentioned in your question EclipseLink MOXy (I'm the tech lead) has the @XmlInverseReference annotation to solve the problem of bidirectional relationships. As of EclipseLink 2.4 MOXy can produce/consume JSON.

    For More Information

    • http://bdoughan.blogspot.com/2010/07/jpa-entities-to-xml-bidirectional.html
    • http://blog.bdoughan.com/2011/08/json-binding-with-eclipselink-moxy.html

提交回复
热议问题