Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLink/UserGuide/MOXy/Relationships/Privately Owned/One-to-One
< EclipseLink | UserGuide | MOXy | Relationships | Privately Owned
Revision as of 12:20, 10 December 2010 by Rick.sapir.oracle.com (Talk | contribs)
EclipseLink | |
Website | |
Download | |
Community | |
Mailing List • Forums • IRC • mattermost | |
Issues | |
Open • Help Wanted • Bug Day | |
Contribute | |
Browse Source |
Examples
One-to-One Composite Collection Mapping
With EclipseLink Annotations
Use the @OneToOne annotation:
@Entity public class Employee { @OneToOne(mappedBy="resident") private Address residence; }
Use the EclipseLink extension @XmlInverseReference to map the back-pointer:
@Entity public class Address { @OneToOne @JoinColumn(name="E_ID") @XmlInverseReference(mappedBy="residence") private Employee resident; }