Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/JPA2.0/derived ids"

(Work Required)
Line 17: Line 17:
 
#: approx 4 days - processing @MappedById and support populating EmbeddedIds
 
#: approx 4 days - processing @MappedById and support populating EmbeddedIds
 
#: approx 3 days - processing derived IdClass in EmbeddedId
 
#: approx 3 days - processing derived IdClass in EmbeddedId
 +
#: approx 1 day - processing XML

Revision as of 12:30, 4 November 2008

Derived Identifiers

JPA 2.0 Root | Enhancement Request

Issue Summary

In JPA 1.0 primary key columns could only be mapped to @Basic attributes. Primary Keys that were derived from Foreign Keys had to be mapped twice, once as the relationship mapping and again as an @Basic. JPA 2.0 adds the functionality to designate a Relationship as providing the primary key for an Entity. Once a relationship is marked as being an ID the PK of that Entity becomes (or includes in the case of composite PK) the ID of the target entity; a derived ID. This feature introduces a new annotation for ID's "MappedByID" used when the derived ID is a component of an EmbeddedID

See JPA 2.0 section 2.1.3.1 for details.

General Solution

Mapping PK to relationship mappings is currently supported in EclipseLink and simple ID's and IdClasses will be easily supported. The EmbeddedID however will be difficult to support as values in the EmbeddedID will need to be populated by EclipseLink on persist(), merge() calls even though they are not the sources of Identity for the Entity. Even more complicated if the derived ID is an IdClass then an instance of that class must be stored in the EmbeddedId which will be new functionality in EclipseLink. Transformation Mapping may be leveraged in combination with the CMP3Policy to support this functionality.

Work Required

  1. Develop model for testing
    approx 4 days - should include all permutations of PK combinations. (ie derived IdClass in EmbeddedId)
  2. Update Processing
    approx 5 days - processing @Id placement
    approx 4 days - processing @MappedById and support populating EmbeddedIds
    approx 3 days - processing derived IdClass in EmbeddedId
    approx 1 day - processing XML

Back to the top