| Summary: | Enhancement: Support @XmlInverseReference where both directions use the same property | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Blaise Doughan <blaise.doughan> |
| Component: | Eclipselink | Assignee: | 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: | |||
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)?
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
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; } }