Let's say I have a web service called getVehicle(int vehicleId) and I'm expecting
it to return me a Vehicle object.
If Vehicle has a java.util.Set of Wheel objects, and the Wheel object has a reference to
its owner (Vehicle), then obviously there is an issue here when trying to persist to XML
because of this bidirectional relationship.
My goal is to have JBoss host this web service, and then use wsimport to create the stub
files for the client to use. This part works fine, except the server throws an error when
it goes to marshal the object:
Caused by: com.sun.istack.SAXException2: A cycle is detected in the object graph. This
will cause infinitely deep XML: org.test.Vehicle@13c6308 -> org.test.Wheel@15880be
-> org.test.Vehicle@13c6308
I have read (and hopefully understand)
https://jaxb.dev.java.net/guide/Mapping_cyclic_references_to_XML.html but I don't
think it applies in this case because wsimport will be creating the stubs for me.
Is there any way to get this going? I'm guessing I will have to fall back to my last
resort, which is making Wheel only have a reference to the Vehicle's ID instead of the
Vehicle object.
Thanks,
Ryan
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4140721#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...