Community
Participate
Working Groups
EclipseLink supports foreign keys referencing non-id fields in OneToOne mappings, but ORM.xml doesn't. ORM.xml assumes that the referenced target field is in the target entity's main table, limiting options. Related to this, OneToOneMappings support target foreign key relationships without requiring a backpointer OneToOneMapping. ORM.xml needs a way to indicate that a OneToOne is using a foreign target key relationship without relying on the mapped by indicator, as EclipseLink should allow any mappping type to set the foreign key. Putting the target table in the join column should help resolving both these issues, as well as another field to allow indicating its a target foreign key when the 1:1 is self referencing. ie PhoneNumber has emp_id basic mapping Employee has 1:1 to phoneNumber using PhoneNumber's emp_id as the foreign key This is allowed in EclipseLink mappings, but cannot be mapped in ORM.xml
Updating priority due to revised bug categorization process. See the following page for details: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines#Priority_and_Target_Milestone If you feel the updated priority is incorrect, please send an email to eclipselink-users@eclipse.org.
Can we support this using: 1. Allow the @JoinColumn's referencedColumnName specify non ID columns 2. For multi-table mappings allow referencedColumnName to be table qualified
Allowing the table qualifer to be added and allowing non ID columns solves half the problem. The other half though is that there is no way to specify that the relationship is target foreign key relationship as in native EclipseLink mappings. Currently, the only way to specify that the target entity/table has the foreign key is to use the mappedby setting, which requires a valid OneToOne/ManyToOne relationship on the target entity. Using the previous example, for the Employee -> PhoneNumber to use the mappedby flag indicating the foreign key is in the PHONE table, PhoneNumber must have a 1:1 to Employee. So this request is to allow non-id fields be used, and mappedby (or some other mechanism to indicate a native EclipseLink foreign target key relationships) used on unidirectional relationships.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink