Java™ Persistence API 2.1 behavior changes
If your existing applications are using the built-in JPA 2.0 persistence provider, OpenJPA or WSJPA, you can continue using the same provider to avoid migration issues. For new applications, use the built-in JPA 2.1 persistence provider, EclipseLink, to take advantage of the new features available in the JPA 2.1 specification. A server can be configured for the JPA 2.1 specification level or the JPA 2.0 specification level, which determines which built-in JPA persistence providers are available. You cannot use both the built-in EclipseLink provider and OpenJPA/WSJPA provider within the same server. If you want to change your existing applications to use the JPA 2.1 persistence provider, EclipseLink, you might need to adjust your application.
Differences between EclipseLink and OpenJPA/WSJPA
There are a few major differences between EclipseLink and OpenJPA/WSJPA that you need to be aware of:
- PersistenceProvider class name
- EclipseLink provider class
- EclipseLink: org.eclipse.persistence.jpa.PersistenceProvider
- Caching behavior
-
EclipseLink: By default, the EclipseLink provider has the L2 cache and QueryCache enabled. You must ensure that this setting is the best option for your applications. If you are running in a distributed environment, like a cluster, you need to disable the cache, or understand that different nodes can have different data.
- Enhancement / weaving differences
-
EclipseLink: EclipseLink works with unenhanced entities. WebSphere Application Server supports static enhancement.
- Data source usage differences
-
EclipseLink uses a non-jta-datasource connection when reading data and a transaction is not active. This means that non-jta-datasource connection pools need to be larger when you use this feature.