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.
EclipseLink/Development/JPA
Contents
- 1 JPA 2.0 Implementation Status
- 2 Goals/Requirements
- 3 Types of Changes
- 4 Development Approach
- 4.1 Class file to be included in EclipseLink JPA bundle
- 4.2 Metadata Changes
- 4.2.1 Features completed:
- 4.2.1.1 • Uni-directional OneToMany without join table
- 4.2.1.2 • Access Type
- 4.2.1.3 • Pessimistic Locking Support
- 4.2.1.4 • Nested embedding
- 4.2.1.5 • Cache APIs
- 4.2.1.6 • New collection mappings
- 4.2.1.7 • Table Per Class Inheritance
- 4.2.1.8 • Application Server support
- 4.2.1.9 • Derived Identifiers
- 4.2.1.10 • EntityManager API updates
- 4.2.1 Features completed:
- 5 JPA 2.0 Features
- 6 JPA 1.0 Optional Features
The EclipseLink project has been chosen to deliver the JPA 2.0 reference implementation as part of JSR 317. This page provides a summary of the work planned and the current status.
JPA 2.0 Implementation Status
At present EclipseLink implements JPA 1.0 with advanced functionality made available through Persistence Unit Properties, Query Hints, a native ORM XML Schema, and native API. Some of the advanced 'extensions' align with what is being discussed for JPA 2.0.
Goals/Requirements
EclipseLink will introduce JPA 2.0 features with the following goals in mind:
- Remain a compliant JPA 1.0 implementation during the development of 2.0 functionality. This is a major requirement since we are working towards a 1.0 release of EclipseLink which must be JPA 1.0 compliant.
- This generally means that the JPA 1.0 persistence.jar could be on the classpath and the product should function as expected
- Conform with the Eclipse IP process and rules. This means that the use of any updated persistence libraries and their source must come into the project through proper IP review procedures.
- All new features involving changes to JPA's ORM-XML schema must be reflected in Eclipse-ORM.XML. This should be done in such a way that changes during the evolution of the specification are minimized.
- Where possible any new features added for JPA 2.0 should also be available to users of the native EclipseLink ORM API and metadata. Accessibility through the native API can be limited to programmatic access and configuration.
- EclipseLink users using JPA 1.0 will be able to access 2.0 preview functionality through native EclipseLink API or metadata
Types of Changes
The JPA 2.0 expert group is attempting to evolve this new specification to remain backwards compatible with JPA 1.0. The scope of its work will involve changes of various types with different effects on EclipseLink.
- Metadata Changes
- New Annotations
- New structures in the persistence.xml XSD
- New structures in the ORM.XML XSD
- API Changes
- New interfaces
- New methods on existing interfaces
Development Approach
We will be developing this functionality within the main product stream. Specification defined interfaces will be created and packaged within a javax.persistence_2.0 bundle/jar for users who wish to preview the functionality. To remain backward compatible with JPA 1.0 we will be packaging any interfaces we must link with for JPA 2.0 within the eclipselink JPA bundle/jar. As this bundle/jar will not contain the EMF API users will be required to choose their JPA version by using the appropriate persistence bundle/jar. Not bundling all the interfaces allows us to produce a single EclipseLink JPA bundle/jar while alleviating the concern of user's hitting preview code when they do not expect to.
Class file to be included in EclipseLink JPA bundle
- javax.persistence.Cache
- javax.persistence.Access
- javax.persistence.AccessType
- javax.persistence.LockModeType
- javax.persistence.LockTimeoutException
- javax.persistence.PessimisticLockException
Metadata Changes
The following changes need to be handled keeping the backwards compatibility to JPA 1.0 goals in mind:
- New Annotations
- Modified Annotations
- Changes to the XML Schemas
- new Interfaces
- reference to new interfaces
Features completed:
• Uni-directional OneToMany without join table
Provide EclipseLink functionality to support a uni-directional OneToMany mapping that does not use a join table. This mapping will be similar to EclipseLink's current AggregateObjectMapping.
• Access Type
Provide support for configurable access type
• Pessimistic Locking Support
Adding support for EntityManager APIs and functionality for Pessimistic locking
• Nested embedding
ER 207823: Embedded objects can nest other embedded objects as well as being able to have relationships to entities.
• Cache APIs
Add support for the new Cache APIs.
• New collection mappings
Collections of embedded objects (aka Aggregate Collections) or of simple objects (Direct Collections)
• Table Per Class Inheritance
Add support for TABLE_PER_CLASS inheritance strategy.
• Application Server support
Ensure that EclipseLink libraries with JPA 2.0 functionality will be able to run on JPA 1.0 compliant application servers.
• Derived Identifiers
Relationship mappings can be used as Id's or components of compound Id's directly without the need for separate primitive attributes.
• EntityManager API updates
Add support for the new EntityManager APIs.
JPA 2.0 Features
The following are features known to be required for JPA 2.0
Note that plumbing for some of these features already does exist in EclipseLink while other parts are going to require feature additions.
Assigned Features:
• Extended Map support
Target ??? - Maps can have keys and values that can be any of basic, entity, or embedded. These are stored in a target table or join table.
• Ordered lists
Order of list is persisted to an "order column" when writes occur
• Standard Properties
Add support for new javax.persistence properties.
• Entity Type Expressions
JPA 2.0 has added syntax to allow restriction of query results by Entity Class type
• Orphan removal
When this option is set on a relationship if a child object is removed from the relationship it must be deleted.
• MetaModel API
266912: Runtime metamodel api implementation (without the APT based canonical metamodel work in 267391.
Unassigned Features to be completed:
• Query Definition API
This will be an object oriented query construction api.
• Integration with Validation API
Through this feature EclipseLink JPA will integrate with the Validation APIs. (JSR-303)
• Undelimited Identifiers
This feature covers specifying and processing metadata Identitfiers.
• JPQL updates
JPA 2.0 introduces certain JPQL updates that do not correspond to other features.
• Nested Fetch Joins
JPA 2.0 Fetch joins have been allowed in JPA 2.0
• Collection Parameters for IN
IN() in JPQL can now accept a single collection parameter.
• CASE Expressions
Case style expressions have been introduce to JPQL and Criteria API
• MetaModel API
267391: APT based canonical metamodel.
JPA 1.0 Optional Features
• Table Per Class Inheritance
Add support for TABLE_PER_CLASS inheritance strategy.