Strive for a more comprehensive, more outstanding
The Java™persistence API (JPA) was first introduced to the Java Platform Enterprise Edition (Java EE) 5 as the canonical Enterprise javabean™ (EJB) 3 Part of the family. Since then, JPA 1.0 has evolved into a popular persistence framework. Even though this initial specification is comprehensive and powerful, there is always room for improvement. The next-generation JPA specification (JPA 2.0) is currently under development in JSR 317.
The JPA Expert Group is working to finalize the JPA 2.0 specification. The canonical public final Draft #2 has recently been released, and the final JPA 2.0 specification is scheduled for release on November 16, 2009.
A comment column does not fully describe all the new features in the JPA 2.0 specification. Therefore, this article introduces these features and provides some information to help you experience these features firsthand through the Apache OpenJPA project.
Persistence of
As I said earlier, the first JPA specification is functionally complete. Many of the new features introduced in JPA 2.0-especially the attributes of object/Relationship (O/R) mapping and domain modeling-are for "edge" situations; These scenarios still exist in the industry because of legacy applications and schemas, but these are not normal daily scenario types. Other major new features, such as the Criteria APIs and the integration with the Bean Validation framework, are just icing on the cake for JPA's persistence features.
Below, let's examine these features carefully:
O/R mapping and domain modeling
Several of the new features of JPA 2.0 are part of the O/R mapping and domain modeling area. Extends the definition and usage of embeddables to include Embeddables collections, nested embeddables, and embeddables that contain relationships to other entities. Of course, the Java persistence Query Language (JPQL) is also updated to support these enhanced embedded features.
Access types (@Access) are also extended in JPA 2.0 to enable specifications on each persistent type, or even on separate properties. These changes provide more flexibility when you architect your entity definitions and associated applications that use these entities.
In JPA 2.0, Elementcollections mapping support is enhanced in addition to the existing Onetomany, Manytoone, and manytomany relationships. Associated annotations for Mapkeycolumn, Mapkeyclass, and Mapkeyjoincolumn are related to this enhanced mapping collection support. In addition, JPQL has been updated to support these new features.
Another new feature associated with domain modeling in JPA 2.0 is the definition of derived identities (derived identity). This allows the ID of an entity to derive from other entities, which provides a parent-to-dependent relationship. The JPA 2.0 specification has several pages (2.4 sections) about the derived identity scenario.