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 graph. This will cause infinitely deep XML".
I read from web that, this problem can be solved with help from @XmlID and @XmlIDREF, but there is one problem, my Id attribute is not String type but Long. and as far as i know @XmlID can be used only with String property.
Other web suggest using eclipselink MOXy, but MOXy cannot generate json.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…