Community
Participate
Working Groups
Created attachment 248294 [details] Test case I experience a strange behavior while marshalling an object graph with bi-directional relationships. The error message is: > Exception [EclipseLink-25037] (Eclipse Persistence Services - > 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.XMLMarshalException > > Exception Description: A cycle is detected in the object graph. This > will cause an infinite loop: > com.moxytest.Cycle$Doc@27f723 -> > com.moxytest.Cycle$Pub@670b40af -> com.moxytest.Cycle$Agree@4923ab24 > -> com.moxytest.Cycle$Agen@44c8afef -> com.moxytest.Cycle$Acc@7b69c6ba -> > com.moxytest.Cycle$Med@46daef40 -> > com.moxytest.Cycle$Pag@12f41634 -> com.moxytest.Cycle$Doc@27f723 The object graph in the exception message seems not in the order of processing. Debugging XPathObjectBuilder shows that on the cycleDetectionStack the objects are pushed in the following order: com.moxytest.Cycle$Doc com.moxytest.Cycle$Pag com.moxytest.Cycle$Med com.moxytest.Cycle$Acc com.moxytest.Cycle$Agen com.moxytest.Cycle$Agree com.moxytest.Cycle$Pub I do not understand why the exception is being thrown because I thought it would be sufficient to use @XmlInverseReference. The problem only occurs with a more complex object graph as attached in the test case. If I remove @XMLElement at setDocs() in class Pub it works. But then I loose the docs objects when marshalling Pub.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink