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
The JAXB specification requires that the property marked with @XmlID be a String property. MOXy impl allows to use long.
One hack to keep using full JAXB compliant implementation would be to duplicate your id in a String field (before serialising)
Don't know so much about JAXB but XStream makes you able to use different modes and some of these modes will give references to the xpath address (absolute or relative) of an element in your xml, if these elements are already displayed. (And you can do Json with XStream)