Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 361296

Summary: Enhancement: Support @XmlInverseReference where both directions use the same property
Product: z_Archived Reporter: Blaise Doughan <blaise.doughan>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: saravanan.subiramaniam
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
URL: http://stackoverflow.com/questions/7811771/is-it-possible-to-use-xmlinversereference-where-object-and-property-are-of-same
Whiteboard:

Description Blaise Doughan CLA 2011-10-18 15:02:20 EDT
Currently MOXy supports @XmlInverseReference using two different properties, one for the containment relationship, and the second for the backpointer.  This enhancement is to support the case where there is only one property.

Below is an example.  Two instances of person reference each other through the spouse property.

  public class Person {
 
     private Person spouse;

     @XmlInverseReference(mappedBy="spouse")
     public Person getSpouse() {
        return spouse;
     }

     public Person setSpouse(Person spouse) {
        this.spouse = spouse;
     }

   }
Comment 1 Saravanan Subiramaniam CLA 2013-06-09 11:28:56 EDT
Hi Blaise,
   I've the following entity:

public class Relationship {
 
     private Relationship reverseRelationship;

     @XmlInverseReference(mappedBy="reverseRelationship")
     public Relationship getReverseRelationship() {
        return reverseRelationship;
     }

     public Relationship setReverseRelationship(Relationship reverseRelationship) {
        this.reverseRelationship = reverseRelationship;
     }

}

and my requirement is that both Relationship and reverseRelationship can be two different instances or the same instance. Will this also be handled (i.e. @XmlInverseReference where both directions use the same property and use the same instance)?
Comment 2 Eclipse Webmaster CLA 2022-06-09 10:27:54 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink