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
- Supported in Entity, MappedSuperclass, and Embeddable classes.
- Default fetch type is Lazy
- 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
Basic Map
- Supported in Entity, MappedSuperclass, and Embeddable classes.
- Default fetch type is Lazy
- 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.
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.