
![[8.5.5.6 or later]](../ng_v8556.gif)
Java Persistence API (JPA) feature overview
There are two JPA features that you can use for your application. jpa-2.0 is built on the Apache OpenJPA open source project. jpa-2.1 is built on the EclipseLink open source project.
jpa-2.0
Java™ Persistence API (JPA) 2.0 for WebSphere Application Server is built on the Apache OpenJPA 2.2.x open source project.
Apache OpenJPA is a compliant implementation of the JPA 1.0 and 2.0 specifications. Using OpenJPA as a base implementation, WebSphere® Application Server employs extensions to provide more features and utilities for WebSphere Application Server customers. Because JPA for WebSphere Application Server is built from OpenJPA, all OpenJPA function, extensions, and configurations are unaffected by the WebSphere Application Server extensions. You do not need to make changes to OpenJPA applications to use these applications in WebSphere Application Server.
JPA for WebSphere Application Server provides more than compatibility with OpenJPA. JPA for WebSphere Application Server contains a set of tools for application development and deployment. Other features of JPA for WebSphere Application Server include support for DB2®Optim pureQuery Runtime, DB2 optimizations, JPA Access Intent, enhanced tracing capabilities, command scripts, and translated message files. The provider of JPA for this product is com.ibm.websphere.persistence.PersistenceProviderImpl.
Apache OpenJPA supports the use of properties to configure the persistent environment. You can specify JPA for WebSphere Application Server properties with either the openjpa or wsjpa prefix. You can mix the openjpa and wsjpa prefixes as you want for a common set of properties. Exceptions to the rule are the wsjpa specific configuration properties, which use the wsjpa prefix. When a JPA for WebSphere Application Server-specific property is used with the openjpa prefix, a warning message is logged indicating that the offending property is treated as a wsjpa property. The reverse does not hold true for the openjpa prefix. In that case, the offending property is ignored.
jpa-2.1
Java Persistence API (JPA) 2.1 for WebSphere Application Server is built on the EclipseLink open source project. EclipseLink is the reference implementation for all version of the JPA specification. The provider of JPA for this product is org.eclipse.persistence.jpa.PersistenceProvider.
The JPA 2.1 specification added new features that are not available in the JPA 2.0 specification. These features include:
- Schema generation
- Type conversion methods
- Entity graphs in queries and find operations
- Unsynchronized persistence contexts
- Stored procedure invocation
- Injection into Entity listener classes
- JPQL enhancements
- Criteria API enhancements
- Mapping of native queries
Refer to the JPA 2.1 specification for more details on these features. This product also provides a subset of the EclipseLink APIs. See the Liberty feature page, Java Persistence API 2.1, for details.
JPA feature compatibility
- jpa-2.0
-
The jpa-2.0 feature is the JPA 2.0 specification implementation and is backed by Apache OpenJPA. This feature is a part of the Java Platform, Enterprise Edition (Java EE) 6 family of technologies, but it is special as it is compatible with other Java EE 7 features. For example, the servlet-3.1 feature, an Java EE 7 feature, is used with the jpa-2.0 feature. This enables applications to stay with the existing JPA provider, but also use new Java EE 7 features.
- jpa-2.1
-
The jpa-2.1 feature is the JPA 2.1 specification implementation and is backed by EclipseLink. This feature is only compatible with other Java EE 7 features. If the jpa-2.1 feature is used with other Java EE 6 features, the following error is emitted into the message.log file.
CWWKF0033E: The singleton features com.ibm.websphere.appserver.javaeeCompatible-7.0 and com.ibm.websphere.appserver.javaeeCompatible-6.0 cannot be loaded at the same time. The configured features jpa-2.1 and servlet-3.0 include one or more features that cause the conflict. Your configuration is not supported; update server.xml to remove incompatible features.