Please don't do this!
The way to handle this is to place the @XmlTransient annotation on one side of the relationship.
If you've got a class, say Category, with methods for getParentCategory() and getChildCategories(), you should put the @XmlTransient annotation on the getParentCategory() method - this way JAXB won't try to convert both the parent and the children to XML, which is what's causing this infinite loop.
If, on the client-side of the Web Service, you require that the getParentCategory() method properly returns the parent category, you'll have to iterate over the results and for every child category call setParentCategory().
[Message sent by forum member 'ryan_kimber' ]
http://forums.java.net/jive/thread.jspa?messageID=372854