Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
EclipseLinkNewAttributeMappings
Contents
Functional Specification: Dali Support for New EclipseLink Attribute Mappings
bug 238460 - basic collection mapping support
bug 238462 - basic map mapping support
bug 238466 - transformation mapping support
Document History
Date | Author | Version Description & Notes |
---|---|---|
6-25-2008 | Karen Butzke | Draft |
Project overview
This feature is about adding the new attribute level mappings annotations supported by the EclipseLink JPA extension.
Goals:
- Add JPA Details view widgets for the BasicCollection, BasicMap and Transformation annotations
- Add JPA Details view widgets for eclipselink-orm.xml basic-collection, basic-map and transformation elements
- Provide the appropriate defaults and validation for these mappings
Concepts
Present any concepts relevant to the feature.
EclipseLink BasicCollection annotation documentation
EclipseLink BasicMap annotation documentation
EclipseLink CollectionTable annotation documentation
EclipseLink Transformation annotation documentation
Requirements / Functionality
Basic Collection
- @BasicCollection supported in Entity, MappedSuperclass, and Embeddable classes.
- Default fetch type is Lazy
- JoinFetch - Select the check box and the JoinFetch annotation is added. The combo box will now display Default (Inner)
- Default Value Column name is <field/property-name>
- Default @CollectionTable name is <Entity-name>_<field/property-name>
- Validation
- Attribute type must be Collection, Set, or List
The following screen shots show options for how we can display a BasicCollection mapping. Option 1 shows the ValueColumn not embedded within the CollectionTable Option 2 shows the ValueColumn embedded within the CollectionTable(see bug 241703) and also the ValueColumn Conversion section embedded in with the ValueColumn Option 3 is for displaying the ValueColumn Conversion section as a separate section.
Basic Map
- @BasicMap supported in Entity, MappedSuperclass, and Embeddable classes.
- Default fetch type is Lazy
- JoinFetch - Select the check box and the JoinFetch annotation is added. The combo box will now display Default (Inner)
- Default Value Column name is <field/property-name>
- Default Key Column name is <field/property-name>_KEY
- Default @CollectionTable name is <Entity-name>_<field/property-name>
From the EclipseLink docs, we can create validation for this. Need to verify that I understand the second statement: Note: If you specify @BasicMap on an attribute of type Collection, EclipseLink will throw an exception: the type must be Map. If you specify the fetch type as LAZY, Map implementation classes are also not valid.
The following screen shots show options for how we can display a BasicCollection mapping. Option 1 shows the ValueColumn/KeyColumn not embedded within the CollectionTable Option 2 shows the ValueColumn/KeyColumn embedded within the CollectionTable(see bug 241703) and also the Conversion sections embedded with their corresponding column Option 3 is for displaying the ValueColumn Conversion section as a separate section.
Transformation
- Supported in Entity, MappedSuperclass, and Embeddable classes.
- An attribute defaults to a Transformation mapping if it includes a @ReadTransformer, @WriteTransformer or @WriteTransformers annotation.
- Define either a ReadTransformer or a WriteTransformer or both. If the mapping is read-only then no WriteTransformer should be defined. If the mapping is write-only then no ReadTransformer should be defined.
- WriteTransformer Column name defaults to attribute name if only one WriteTransformer. If multiple, the column name must be specified.
- Supports fetch with a default of FetchType.EAGER
- Supports optional with a default of true
- Validation errors
- ReadTransformer or WriteTransformer annotation includes both a method and a transformer class, it is only valid to specify one.
- Multiple WriteTransformers, but all don't specify a column name
- WriteTransformer column does not exist on the database.
- ReadTransformer/WriteTransformer method does not exist on the mapped class.
- ReadTransformer class does not exist or does not implement org.eclipse.persistence.mappings.transformers.AttributeTransformer.
- WriteTransformer class does not exist or does not implement org.eclipse.persistence.mappings.transformers.FieldTransformer.
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.