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 "Dali Project/specs/3.0/2.0ElementCollection"

(New page: = Functional Specification: Dali Support for JPA 2.0 Element Collection mapping = Feedback [http://bugs.eclipse.org/239137 bug 239137] - cache sup...)
 
(Requirements / Functionality)
 
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
= Functional Specification: Dali Support for JPA 2.0 Element Collection mapping =
 
= Functional Specification: Dali Support for JPA 2.0 Element Collection mapping =
  
[[Talk:EclipseLinkCachingAndLocking | Feedback]]
+
[https://bugs.eclipse.org/258490 bug 258490] - element collection support
  
[http://bugs.eclipse.org/239137 bug 239137] - cache support
 
 
[http://bugs.eclipse.org/239148 bug 239148] - optimistic locking support
 
  
 
== Document History ==
 
== Document History ==
Line 14: Line 11:
 
! Version Description & Notes
 
! Version Description & Notes
 
|-
 
|-
!7-1-2008
+
!12-9-2009
 
!Karen Butzke
 
!Karen Butzke
 
!Draft
 
!Draft
Line 21: Line 18:
 
== Project overview ==
 
== Project overview ==
  
This feature covers entity/mapped superclass level caching and optimistic locking supported by the EclipseLink JPA extension.
+
This feature covers the element collection mapping in the JPA 2.0 spec as well as any EclipseLink extensions.
  
 
Goals:
 
Goals:
  
* Add JPA Details view widgets for the Cache, ExistenceChecking, OptimisticLocking annotations
+
* Add Generic 2.0 support for Element Collection
* Add JPA Details view widgets for eclipselink-orm.xml cache, existence-checking and optimistic-locking elements
+
* Add EclipseLink 3.0 support for Element Collection with relevant extensions
 
* Provide the appropriate defaults and validation for these settings
 
* Provide the appropriate defaults and validation for these settings
  
Line 33: Line 30:
 
Present any concepts relevant to the feature.
 
Present any concepts relevant to the feature.
  
[http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#How_to_Use_the_.40Cache_Annotation EclipseLink Cache annotation documentation]
+
[http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/new_collection_mappings EclipseLink Element Collection Functional Spec]
 
+
[http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Extensions_for_Optimistic_Locking EclipseLink OptimisticLocking annotation documentation]
+
  
 
== Requirements / Functionality ==
 
== Requirements / Functionality ==
  
=== Caching ===
+
=== Element Collection with No Type ===
 +
* target-class - defaults to type of the Collection if generic, must be specified otherwise
 +
* fetch - defaults to Lazy
 +
* collection-table and @CollectionTable
 +
** name defaults to <Entity name>_<attribute name>
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 +
* Validation
 +
** Error that target class must be specified since collection is not generic
  
* [[Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Extensions_for_Entity_Caching|@Cache]] supported in Entity and MappedSuperclass classes.
+
[[Image: ElementCollectionNoType.jpg]]
* Cache Type options
+
** Default (Weak with Soft subcache)
+
** Weak with Soft Subcache  -> CacheType.SOFT_WEAK
+
** Weak with Hard Subcache  -> CacheType.HARD_WEAK
+
** Weak  -> CacheType.WEAK
+
** Soft  -> CacheType.SOFT
+
** Full  -> CacheType.FULL
+
** Cache  -> CacheType.CACHE - do we want to support this?? We didn't in the mapping workbench
+
** None  -> CacheType.NONE
+
* Coordination Type
+
** Default (Send Object Changes)
+
** Send Object Changes
+
** Invalidate Changed Objects
+
** Send New Objects with Changes
+
** None
+
* @ExistenceChecking supported in Entity and MappedSuperclass classes.
+
** Default (Check Database) - if the empty annotation is added, the default becomes Check Cache.  See the second screen shot below
+
** Check Cache  -> ExistenceType.CHECK_CACHE
+
** Check Cache then Database  -> ExistenceType.CHECK_DATABASE
+
** Assume Existence  -> ExistenceType.ASSUME_EXISTENCE
+
** Assume Non-Existence  -> ExistenceType.ASSUME_NON_EXISTENCE
+
* Shared Cache
+
** What should we label this instead?  Possible options are 'Cache in L2 Cache' or 'Maintain in L2 Cache'.  In the @Cache annotation it is just 'shared'.
+
** If set to false then the panel is disabled and all Cache settings are removed.  You will be left with @Cache(shared=false) in the java source.
+
*Expiry
+
** Should we follow the Mapping Workbench or more closely follow the new EclipseLink annotations?  The 'Time To Live Expiry' would add the expiry element to the Cache annotation.  The 'Daily Expiry' would add the expiryTimeOfDay element to the Cache annotation. Potentially the radio buttons could be 'No Expiry', 'Expiry', 'Time of Day Expiry'
+
  
'''Entity 'Caching' section'''
 
  
[[Image: EntityCaching.jpg]]
+
=== Element Collection with Basic Type ===
  
 +
* target-class - defaults to type of the Collection if generic, must be specified otherwise
 +
* fetch - defaults to Lazy
 +
* collection-table and @CollectionTable
 +
** name defaults to <Entity name>_<attribute name>
 +
* column and @Column
 +
** name defaults to attribute name
 +
** table defaults to collection table name and is not editable
 +
* temporal and @Temporal
 +
* enumerated and @Enumerated
 +
* lob and @Lob
 +
* convert and @Convert (EclipseLink)
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
  
Existence Checking combo if the ExistenceChecking annotation or xml element exists, the default changes.
 
  
[[Image: ExistenceChecking.jpg]]
+
'''Element Collection Basic Type Details'''
  
 +
[[Image: ElementCollectionBasicType.jpg]]
  
'''For reference, 'Caching' tab from the MW'''
 
  
[[Image: MWCaching.jpg]]
+
'''Ordering Section'''
  
 +
[[Image:Ordering.jpg]]
  
'''For reference, 'Refreshing Cache Options' section from the MW'''
 
  
[[Image: MWCaching2.jpg]]
+
=== Element Collection with Embeddable Type ===
  
=== Optimistic Locking ===
+
* target-class - defaults to type of the Collection if generic, must be specified otherwise
 +
* fetch - defaults to Lazy
 +
* collection-table and @CollectionTable
 +
** name defaults to <Entity name>_<attribute name>
 +
*Attribute and Association override names are derived from the Embeddable type
 +
**Are we expected to support value dot notation here?  Could the attribute override be specified as name="value.street"?
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
  
*[[Using_EclipseLink_JPA_Extensions_(ELUG)#Using_EclipseLink_JPA_Extensions_for_Optimistic_Locking|@OptimisticLocking]] annotation supported in Entity and MappedSuperclass classes. Corresponding eclipselink-orm.xml element is optimistic-locking
+
'''Element Collection Embeddable Type Details'''
* Type Options
+
 
** Default (Version Column)
+
[[Image: ElementCollectionEmbeddableType.jpg]]
** All Columns      -> OptimisticLockingType.ALL_COLUMNS
+
 
** Changed Columns  -> OptimisticLockingType.CHANGED_COLUMNS
+
 
** Selected Columns  -> OptimisticLockingType.SELECTED_COLUMNS
+
=== Element Collection with No Key Type Or Value Type===
** Version Column    -> OptimisticLockingType.VERSION_COLUMN
+
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 
* Validation
 
* Validation
** Type is 'Selected Columns' but no columns are selected
+
** Error that target class must be specified since Map is not generic
** Selected Columns must be mapped and must not be primary keys
+
** Error that map key class must be specified since Map is not generic
** If using Optimistic Locking with anything other than Version Column, the @Version annotation will be ignored (warning, not error, for this)
+
 
** If 'cascade' is set and type is not 'Version Column', warning that it is not supported.
+
[[Image: ElementCollectionMapNoKeyOrValueType.jpg]]
** If type is 'Version Column' or @OptimisticLocking is specified without a type, there must be a mapping marked @Version.
+
 
 +
 
 +
=== Element Collection Map Basic Key and Basic Value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* Value column definition
 +
** column and @Column
 +
** temporal and @Temporal
 +
** enumerated and @Enumerated
 +
** lob and @Lob
 +
** convert and @Convert (EclipseLink)
 +
* Key column definition
 +
** map-key-column and @MapKeyColumn
 +
*** name defaults to <attribute name>_KEY
 +
** map-key-temporal and @MapKeyTemporal
 +
** map-key-enumerated and @MapKeyEnumerated
 +
** map-key-convert and @MapKeyConvert (EclipseLink)
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 +
* Validation errors:
 +
** MapKey and MapKeyClass are both specified
 +
 
 +
 
 +
'''Element Collection Map with Basic Key and Basic Value Details'''
 +
 
 +
[[Image: ElementCollectionMapBasicKeyAndValue.jpg]]
 +
 
 +
 
 +
=== Element Collection Map Embeddable Key and Embeddable value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* Value overrides
 +
** In Xml attribute-override, in Java @AttributeOverride
 +
** In Xml association-override, in Java @AssociationOverride
 +
* Key overrides
 +
** In Xml use map-key-attribute-override and map-key-association-override
 +
** In Java use AttributeOverride(name="key.<name>") and AttributeOverride(name="value.<name>)
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 +
 
 +
 
 +
[[Image: ElementCollectionMapEmbeddableKeyAndEmbeddableValue.jpg]]
 +
 
 +
 
 +
=== Element Collection Map Embeddable Key and Basic value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* Value column definition
 +
** column and @Column
 +
** temporal and @Temporal
 +
** enumerated and @Enumerated
 +
** lob and @Lob
 +
** convert and @Convert (EclipseLink)
 +
* Key overrides
 +
** In Xml use map-key-attribute-override and map-key-association-override
 +
** In Java use AttributeOverride(name="key.<name>") and AttributeOverride(name="value.<name>)
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 +
 
 +
Screen shot is similar to others with the Map Value section having column and type and the Map Key section having overrides
 +
 
 +
=== Element Collection Map Basic Key and Embeddable Value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* Value overrides
 +
** In Xml attribute-override, in Java @AttributeOverride
 +
** In Xml association-override, in Java @AssociationOverride
 +
* Key column definition
 +
** map-key-column and @MapKeyColumn
 +
*** name defaults to <attribute name>_KEY
 +
** map-key-temporal and @MapKeyTemporal
 +
** map-key-enumerated and @MapKeyEnumerated
 +
** map-key-convert and @MapKeyConvert (EclipseLink)
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
 +
* Validation errors:
 +
** MapKey and MapKeyClass are both specified
 +
 
 +
Screen shot is similar to others with the Map Value section having overrides and the Map Key having column and type
 +
 
 +
=== Element Collection Map Entity Key and Basic Value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* Value column definition
 +
** column and @Column
 +
** temporal and @Temporal
 +
** enumerated and @Enumerated
 +
** lob and @Lob
 +
** convert and @Convert (EclipseLink)
 +
* Key column definition
 +
** map-key-join-column and @MapKeyJoinColumn
 +
*** default name is <attribute name>_KEY
 +
*** default referenced column name is the primary key of the referenced table
 +
** @MapKeyJoinColumns
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
  
* If no @Version annotation exists the Default option will display 'Default (None)
+
[[Image: ElementCollectionMapEntityKeyAndBasicValue.jpg]]
* If a Version annotation exists, the default option will display 'Default (Version Column)
+
  
  
[[Image: EntityOptimisticLocking2.jpg]]
+
=== Element Collection Map Entity Key and Embeddable Value ===
 +
* target-class - defaults to type of the Map value if generic, must be specified otherwise
 +
* fetch - defaults to Lazy
 +
* collection-table and @Collection Table
 +
** Name defaults to <Entity name>_<attribute name>
 +
* map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
 +
* map-key and @MapKey - this and MapKeyClass are mutually exclusive
 +
* Value overrides
 +
** In Xml attribute-override, in Java @AttributeOverride
 +
** In Xml association-override, in Java @AssociationOverride
 +
* Key column definition
 +
** map-key-join-column and @MapKeyJoinColumn
 +
*** default name is <attribute name>_KEY
 +
*** default referenced column name is the primary key of the referenced table
 +
** @MapKeyJoinColumns
 +
* order-by and @OrderBy
 +
* order-column and @OrderColumn
  
 +
Screen shot is similar to others with the 'Map Value' section having overrides and the 'Map Key' section having join columns
  
'''For Reference, Locking tab from MW'''
 
  
[[Image: MWLocking.jpg]]
+
=== Validation ===
 +
* From the spec: An embeddable class (including an embeddable class within another embeddable class) that is contained
 +
within an element collection must not contain an element collection, nor may it contain a relationship
 +
to an entity other than a many-to-one or one-to-one relationship. The embeddable class must be
 +
on the owning side of such a relationship and the relationship must be mapped by a foreign key mapping.
 +
*Bidirectional relationships represented as java.util.Map collections support the use of the Map
 +
datatype on one side of the relationship only.
 +
* ElementCollection specified but Map value type is an entity
 +
* ElementCollection specified but Collection type is an entity
 +
* Both MapKey and MapKeyClass specified on an element collection
 +
* Database validation
 +
** Column name and table
 +
** CollectionTable name, schema, catalog
 +
** MapKeyColumn name and table
 +
** MapKeyJoinColumn name, referencedColumnName, table
 +
** Attribute override name and column
 +
** Association override name and column
  
 
== API ==
 
== API ==

Latest revision as of 13:33, 16 December 2009

Functional Specification: Dali Support for JPA 2.0 Element Collection mapping

bug 258490 - element collection support


Document History

Date Author Version Description & Notes
12-9-2009 Karen Butzke Draft

Project overview

This feature covers the element collection mapping in the JPA 2.0 spec as well as any EclipseLink extensions.

Goals:

  • Add Generic 2.0 support for Element Collection
  • Add EclipseLink 3.0 support for Element Collection with relevant extensions
  • Provide the appropriate defaults and validation for these settings

Concepts

Present any concepts relevant to the feature.

EclipseLink Element Collection Functional Spec

Requirements / Functionality

Element Collection with No Type

  • target-class - defaults to type of the Collection if generic, must be specified otherwise
  • fetch - defaults to Lazy
  • collection-table and @CollectionTable
    • name defaults to <Entity name>_<attribute name>
  • order-by and @OrderBy
  • order-column and @OrderColumn
  • Validation
    • Error that target class must be specified since collection is not generic

ElementCollectionNoType.jpg


Element Collection with Basic Type

  • target-class - defaults to type of the Collection if generic, must be specified otherwise
  • fetch - defaults to Lazy
  • collection-table and @CollectionTable
    • name defaults to <Entity name>_<attribute name>
  • column and @Column
    • name defaults to attribute name
    • table defaults to collection table name and is not editable
  • temporal and @Temporal
  • enumerated and @Enumerated
  • lob and @Lob
  • convert and @Convert (EclipseLink)
  • order-by and @OrderBy
  • order-column and @OrderColumn


Element Collection Basic Type Details

ElementCollectionBasicType.jpg


Ordering Section

Ordering.jpg


Element Collection with Embeddable Type

  • target-class - defaults to type of the Collection if generic, must be specified otherwise
  • fetch - defaults to Lazy
  • collection-table and @CollectionTable
    • name defaults to <Entity name>_<attribute name>
  • Attribute and Association override names are derived from the Embeddable type
    • Are we expected to support value dot notation here? Could the attribute override be specified as name="value.street"?
  • order-by and @OrderBy
  • order-column and @OrderColumn

Element Collection Embeddable Type Details

ElementCollectionEmbeddableType.jpg


Element Collection with No Key Type Or Value Type

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • order-by and @OrderBy
  • order-column and @OrderColumn
  • Validation
    • Error that target class must be specified since Map is not generic
    • Error that map key class must be specified since Map is not generic

ElementCollectionMapNoKeyOrValueType.jpg


Element Collection Map Basic Key and Basic Value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • Value column definition
    • column and @Column
    • temporal and @Temporal
    • enumerated and @Enumerated
    • lob and @Lob
    • convert and @Convert (EclipseLink)
  • Key column definition
    • map-key-column and @MapKeyColumn
      • name defaults to <attribute name>_KEY
    • map-key-temporal and @MapKeyTemporal
    • map-key-enumerated and @MapKeyEnumerated
    • map-key-convert and @MapKeyConvert (EclipseLink)
  • order-by and @OrderBy
  • order-column and @OrderColumn
  • Validation errors:
    • MapKey and MapKeyClass are both specified


Element Collection Map with Basic Key and Basic Value Details

ElementCollectionMapBasicKeyAndValue.jpg


Element Collection Map Embeddable Key and Embeddable value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • Value overrides
    • In Xml attribute-override, in Java @AttributeOverride
    • In Xml association-override, in Java @AssociationOverride
  • Key overrides
    • In Xml use map-key-attribute-override and map-key-association-override
    • In Java use AttributeOverride(name="key.<name>") and AttributeOverride(name="value.<name>)
  • order-by and @OrderBy
  • order-column and @OrderColumn


ElementCollectionMapEmbeddableKeyAndEmbeddableValue.jpg


Element Collection Map Embeddable Key and Basic value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • Value column definition
    • column and @Column
    • temporal and @Temporal
    • enumerated and @Enumerated
    • lob and @Lob
    • convert and @Convert (EclipseLink)
  • Key overrides
    • In Xml use map-key-attribute-override and map-key-association-override
    • In Java use AttributeOverride(name="key.<name>") and AttributeOverride(name="value.<name>)
  • order-by and @OrderBy
  • order-column and @OrderColumn

Screen shot is similar to others with the Map Value section having column and type and the Map Key section having overrides

Element Collection Map Basic Key and Embeddable Value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • Value overrides
    • In Xml attribute-override, in Java @AttributeOverride
    • In Xml association-override, in Java @AssociationOverride
  • Key column definition
    • map-key-column and @MapKeyColumn
      • name defaults to <attribute name>_KEY
    • map-key-temporal and @MapKeyTemporal
    • map-key-enumerated and @MapKeyEnumerated
    • map-key-convert and @MapKeyConvert (EclipseLink)
  • order-by and @OrderBy
  • order-column and @OrderColumn
  • Validation errors:
    • MapKey and MapKeyClass are both specified

Screen shot is similar to others with the Map Value section having overrides and the Map Key having column and type

Element Collection Map Entity Key and Basic Value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • Value column definition
    • column and @Column
    • temporal and @Temporal
    • enumerated and @Enumerated
    • lob and @Lob
    • convert and @Convert (EclipseLink)
  • Key column definition
    • map-key-join-column and @MapKeyJoinColumn
      • default name is <attribute name>_KEY
      • default referenced column name is the primary key of the referenced table
    • @MapKeyJoinColumns
  • order-by and @OrderBy
  • order-column and @OrderColumn

ElementCollectionMapEntityKeyAndBasicValue.jpg


Element Collection Map Entity Key and Embeddable Value

  • target-class - defaults to type of the Map value if generic, must be specified otherwise
  • fetch - defaults to Lazy
  • collection-table and @Collection Table
    • Name defaults to <Entity name>_<attribute name>
  • map-key-class and @MapKeyClass - defaults to the type of the Map key if generic, must be specified otherwise and if MapKey is not
  • map-key and @MapKey - this and MapKeyClass are mutually exclusive
  • Value overrides
    • In Xml attribute-override, in Java @AttributeOverride
    • In Xml association-override, in Java @AssociationOverride
  • Key column definition
    • map-key-join-column and @MapKeyJoinColumn
      • default name is <attribute name>_KEY
      • default referenced column name is the primary key of the referenced table
    • @MapKeyJoinColumns
  • order-by and @OrderBy
  • order-column and @OrderColumn

Screen shot is similar to others with the 'Map Value' section having overrides and the 'Map Key' section having join columns


Validation

  • From the spec: An embeddable class (including an embeddable class within another embeddable class) that is contained

within an element collection must not contain an element collection, nor may it contain a relationship to an entity other than a many-to-one or one-to-one relationship. The embeddable class must be on the owning side of such a relationship and the relationship must be mapped by a foreign key mapping.

  • Bidirectional relationships represented as java.util.Map collections support the use of the Map

datatype on one side of the relationship only.

  • ElementCollection specified but Map value type is an entity
  • ElementCollection specified but Collection type is an entity
  • Both MapKey and MapKeyClass specified on an element collection
  • Database validation
    • Column name and table
    • CollectionTable name, schema, catalog
    • MapKeyColumn name and table
    • MapKeyJoinColumn name, referencedColumnName, table
    • Attribute override name and column
    • Association override name and column

API

Issues

This section lists the open issues that are still pending that must be decided prior to fully implementing this project's requirements.

Issue # Owner Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

Back to the top