In JPA 2.0 the specification extends the access type configuration. Access Type will be specified at the Entity Level or the Property Level. New annotations have also been added providing configuration in the Java Class along with orm.xml
See JPA 2.0 ED section 2.3 for details.
Our Entity Processing code must now process the entire entity if an explicit access type has been specified. Also since inheritance subclasses can now explicitly specify the Access annotation and override the the inherited access type from from the root. (The root being the first parent that defines an inheritance strategy) this will now need to be changed to the first parent of the inheritance hierarchy that does not specify an explicit type. We therefore need to change our processing to ensure inheritance hierarchies are completely processed top->down. Previously we only ensured the root of the inheritance hierarchy had been processed before processing a sub-class of that hierarchy.
A quick break down of the processing logic to determine the access type is as follows:
Entity access type:
- Check for an explicit access type setting in XML on the entity
- Check for an explicit access type setting on the entity class
- Check the parents access type of an inheritance hierarchy (ignoring those parents with an explicit access type)
- Note: Inheritance hierarchies are processed top down
- Check the location of annotations on the mapped superclasses (ignoring those mapped superclasses with an explicit access type)
- Check the location of annotations on the entity class itself
- Check for an xml default from a persistence-unit-metadata-defaults or entity-mappings setting.
- Search has been exhausted, EclipseLink will default to FIELD.
Embeddable access type:
Processing of accessors is as follows:
- Process the accessors accordingly (and as we currently do)
- New processing step, process the inverse access type accessors if an explicit access type has been specified.
- If the access type is FIELD, process those properties that explicitly define Access(PROPERTY), ignore all others.
- If the access type is PROPERTY, process those fields that explicitly define Access(FIELD), ignore all others.
- At all stages of processing an exception will be thrown in the following cases:
- An Access(FIELD) is found on a property
- An Access(PROPERTY) is found on a field.
- Encountered during the entity processing and will continue to inherit its access type from the owning entity. The exception case now being if the @Embeddable defines an access type.
- Processing of the embedable accessors will follow the processing logic defined for an entity.
- XML merging (EclipseLink extended functionality) remains as implemented. No changes are necessary.
- Develop model for testing access type settings
- approx 2 days
- Update Processing to process entire table
- approx 3 days