JPA2.0AccessAnnotationSupport

From Eclipsepedia

Jump to: navigation, search

Contents

Functional Specification: Dali Support for JPA 2.0 Access annotation

bug 258487 - Access annotation support

Document History

Date Author Version Description & Notes
1-7-2009 Karen Butzke Draft

Project overview

This feature is about adding the new JPA 2.0 Access annotation. This will only be added to the EclipseLink platform and is supported in EclipseLink 1.1

Goals:

  • Add a JPA Details view widget for changing the access type of Java Entities, MappedSuperclasses, and Embeddables
  • Add JPA structure view support for adding mixed access mappings and changing existing mapping to the opposite access
  • Provide the appropriate defaults and validation for these settings

Concepts

Present any concepts relevant to the feature.

EclipseLink Access annotation functional spec

Requirements / Functionality

Access Type

@Access annotation is supported on Entity, Embeddable, MappedSuperclass and all field/properties Access type options, to be displayed as a combo box:

  • Default ( )
  • Field
  • Property


Entity

The default access type for an Entity will still be calculated the same way.

Access type explicitly specified as FIELD:
  • JPA Structure view will have a right-click menu option 'Add Persistent Property...'. This will open a dialog and display properties matching the JavaBeans conventions. When the user chooses one, the @Access(PROPERTY) annotation will be added to the get method and the property will appear in the structure view. The user will have to manually set the corresponding field to Transient, if there is a corresponding field.
  • The attribute mappings in the structure will display all the instance variable for the class, as it does now. If any properties have @Access(PROPERTY) defined on them, those will be in the structure view as well. Right click on a mapping in the structure view and you will see an option 'Specify Property Access...'. This will open a dialog allowing you to choose a property matching the JavaBeans conventions. When the user chooses one, the @Transient annotation will be placed on the instance variable and the @Access(PROPERTY) will be placed on the chosen property.
Access type explicitly specified as PROPERTY:
  • Same as above, but menu options are 'Add Persistent Field...' and 'Specify Field Access...' and @Access(FIELD) is placed on the chosen field.

MappedSuperclass

Embeddable

Join Fetch

@JoinFetch annotation is supported on OneToOne, OneToMany, ManyToOne, ManyToMany, BasicCollection, and BasicMap mappings. The corresponding element in the eclipselink-orm.xml is join-fetch.

Join Fetch options, to be displayed as a combo box:

  • Default (Inner)
  • Inner
  • Outer

A checkbox is used to enabled Join Fetch, if you check it the JoinFetch annotation is added and the combo box is enabled and displays Default(inner).


OneToOneJoinFetchPrivateOwned.jpg

Private owned and join fetch widgets on a OneToOne

Mutable

@Mutable annotation is supported on Id, Basic, Version, and Transformation mappings. The corresponding element in the eclipselink-orm.xml is mutable.

If attribute type is Serializable then mutable defaults to true, otherwise it defaults to false. If no Mutable annotation is specified and the type is a Date or Calendar the default is taken from the persistence unit property eclipselink.temporal.mutable 228042. Where should this setting go in the EclipseLink persistence.xml editor?

Possibly put a hyperlink from Mutable to the global setting in the persistence.xml editor, could do this for other settings as well. 241265

BasicMutable.jpg

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.