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

EclipseLink/Development/JPA2.0/Extended Map support/MappedKeyMapContainerPolicy

< EclipseLink‎ | Development‎ | JPA2.0/Extended Map support
Revision as of 12:22, 14 November 2008 by Tom.ware.oracle.com (Talk | contribs) (CollectionTableMapMapping)

CollectionTableMapMapping

CollectionTableMapMapping will be any Map mapping that contains either part of it's key or part of its value in a CollectionTable. Much of CollectionTableMapMapping's functionality will be similar to ManyToManyMapping because of the fact that both mappings use a relation table.

Mapping Changes

Mapping Hierarchy

The mapping hierarchy will be updated to include new abstract class CollectionTableMapping with two subclasses, ManyToManyMapping and CollectionTableMapMapping.

CollectionTableMapping

CollectionTableMapping will contain a large portion of the code that is now contained in ManyToManyMapping. It will be responsible for everything on the source side of the relationship:

  • It will hold the insert, update and delete queries for the mapping
  • It will contain the keys for source side of the relationship
  • It will provide the framework that allows its subclasses to work

ManyToManyMapping

ManyToManyMapping will now inherit from RelationTableMapping, and now contain the information and functionality to cope with the target part of the relationship.

  • It will contain the target keys
  • It will initialize the queries stored in its parent class
  • It will manage the target side of the relationship

CollectionTableMapMapping

The new CollectionTableMapMapping class will be added as a subclass of RelationTableMapping. It will store the mappings for the key and the value of the map.

  • It will a mapping related to the key and one related to the value of the map
  • It will initialize the mappings it holds and the queries stored in its superclass
  • It will provide the functionality needed to deal with multiple mappings for the target
  • It will delegate much of the functionality related to its keys and values to its contained mappings

MapComponentMapping

A new interface will be created call MapComponentMapping. This interface will provide the API that mapping that can be either the key or the value for a CollectionTableMapMapping must implement. The following mappings will implement this interface:

  • AbstractDirectMapping
  • AggregateObjectMapping
  • OneToOneMapping

Only MapComponentMappings will be eligable as the key or value of a CollectionTableMapMapping.

Container Policy Hierarchy

A new subclass of MapContainerPolicy will be added called CollectionTableMapContainerPolicy. It's main purpose will be to extend MapContainerPolicy to allow the key to be treated as a first-class element.

The way container policies work will change somewhat because CollectionTableMapMapping means that for the first time, one mapping actually encapsultes two distinct mappings. As a result, the iterator currently provided by ContainerPolicy will have some functionality added to allow it to iterate through objects that may or may not be key-value pairs. Any code that makes use of an iterator for a ContainerPolicy will have to be updated to be aware that the returned values could be a key-value pair.

Back to the top