• 1 reply
  • Latest Post - ‏2010-08-31T02:38:00Z by RohitK
17 Posts

Pinned topic Feature Focus Week: JPA 2.0 (Beta)

‏2010-08-30T14:51:50Z |

JPA 2.0

JPA 2.0 is an important piece of the Java EE 6 solution. JPA 2.0 builds upon the solid foundation provided by JPA 1.0 in the Java EE 5 timeframe. In addition to providing additional support for legacy situations, it also provides several new features to cement itself as the premier persistence framework.

JPA 2.0 is so important to our customer base that we decided to create a separate Feature Pack that works with WebSphere v7. As part of our normal process, the capabilities introduced by a Feature Pack are then incorporated into our next release. Thus, most of the JPA 2.0 functionality provided by the JPA Feature Pack is already part of the WebSphere Application Server v8.0 Beta.

Key JPA 2.0 Features

Some of the key JPA 2.0 features available in the WebSphere Application Server v8.0 Alpha include:

Access Types

Expanded to allow specification on a per-persistent type basis or on individual attributes.


Expanded to include collections of embeddables, nested embeddables, and embeddables containing relationships to other entities.

Enhanced Map Collections

Expanded to support ElementCollection and new annotations for MapKeyColumn, MapKeyClass and MapKeyJoinColumn.

Derived Identities

Enables the ID of an entity to be derived from another entity, which provides for parent-to-dependent relationships.

Query API

Methods to get typed query parameters and results, supported and in-effect hints and lock mode getter/setter.


Official support for Pessimistic locking (included in prior OpenJPA releases) along with LockModeType properties and hint.

JPQL Updates

  • Embeddables support for path expressions to nested Embeddables and Embeddables with relationships
  • Enhanced Map Collection support for ElementCollection and new query expressions for KEY, ENTRY, VALUE
  • Support for CASE and TYPE expressions along with IN expressions for Collection parameters
  • Support for native date/time/timestamp literals
  • Support for INDEX expressions on an OrderColumn

L2 Cache

  • Provides cache operations such as entity eviction and cache mode behaviors to use, bypass or refresh items
  • Per-entity annotation to specify whether an entity should be cached

Bean Validation

Supports using a JSR 303 implementation for entity validation for persist and remove operations.

Metamodel API

  • Provides API to dynamically retrieve metamodel information for a persistence unit
  • Currently limited to persistent state and relationships
  • Used with Criteria API to generate and execute type safe queries
  • Supports dynamic or static generation of the metamodel

Criteria API

  • Provides programmatic construction of queries using an object based query graph
  • Operates on Metamodel objects to provide compile-time type safety enforcement

EntityManagerFactory API

Updated for new L2 Cache, Properties, Criteria and Metamodel APIs

EntityManager API

Updated for new Query and Query Result APIs, Hints, Properties, LockModeType, and Detach

And many more...

Try it out

The WebSphere JPA 2.0 solution is available in either the WebSphere Application Server v8 Alpha or as part of the WebSphere Application Server v7 Feature Pack for OSGi Applications and JPA 2.0. Or, if you are just interested in experimenting with the JPA 2.0 functionality in a standalone JVM, you could try out the OpenJPA 2.0 release. Feedback is welcome no matter which binary is used.
Updated on 2010-08-31T02:38:00Z at 2010-08-31T02:38:00Z by RohitK
  • RohitK
    38 Posts

    Re: Feature Focus Week: JPA 2.0

    Dynamic cache provider for the JPA 2.0 second level cache

    One of the key features of JPA2.0 is the ability to plugin a Level L2 cache provider. This allows customers to use the default provider or plugin any custom provider such as ehcache or Dynacache. A dynamic cache JPA second level (L2) cache provider for OpenJPA 2.0 shares entity states across various persistence contexts, transactions and users. When caching is enabled, entities that are not found in the persistence context are loaded from the L2 cache. L2 caching avoids database access for currently-loaded entities.

    WebSphere Dynacache, the default baked-in cache of WAS can be configured as a L2 cache provider to default persistence provider in WAS8 alpha. For details on how to configure the Dynacache cache provider with OpenJPA 2.0 see The Dynacache L2 cache provider can be used for data cache and the query cache. Query cache stores the object ids returned by query executions Data cache stores the entities returned by em.find() calls.

    Why bother with the Dynacache L2 Cache Provider for OpenJPA 2.0 in WAS8 alpha ?
    1. Production readiness: Dynacache is the default cache for WAS. Dynacache has been used in customer deployments for over 8 years
    2. Multi-JVM caching through Data Replication Service via the openjpa.RemoteCommitProvider property
    3. Advanced monitoring and administration through the Dynacache runtime mbean, Dynacache cache monitor application & PMI Statistics
    4. zOS Servant region in-memory & in-process JVM cache
    5. Focus on consumability and ease of use. One step configuration through system-wide aliases

    For more information on how-to configure the Dynacache cache provider please see

    --Thank You,
    Rohit Kelapure