JPA 2.1 New Features

In this section you will learn about the new features of JPA 2.1 which is released through JSR-338 and part of JEE 7 specification.

This section is explaining you the new features of JPA 2.1. The JPA 2.1 specification is coming with many new features and enhancements. The JPA 2.1 aims to make the development of persistence layer easy and maintainable. The JPA 2.1 specification is defined through the JSR-338.

What are new features of JPA 2.1?

The JPA 2.1 specification introduced many new features and enhancements. It is developed to enable the developers to make demanding applications by enterprises.

The JPA 2.1 is industry standard object/relational mapping solution for the Java and can be used with both Java SE and Java EE applications. The Java EE 7 needs JPA 2.1. So if you are planning to use the JEE 7 for application development you should use the JPA 2.1.

Here are the new features of JPA 2.1

The latest JPA 2.1 is part of JEE 7 specification and it includes many updates as compared to the earlier JPA specification. It includes many updates, new features and major functional enhancements which makes programming much easier.

Following picture shows the new features of JPA 2.1

new features of JPA 2.1

Here are the new features and enhancements in JPA 2.1:

  • Stored Procedure support: Now JPA 2.1 formally supports Stored Procedures.
  • SynchronizationType: SynchronizationType is added to control when to enlist with transaction.
  • CDI support : Now CDI support added for the Entity Listeners
  • Type Conversions: Now Type Conversions support is added to the JPA 2.1 specification. It is similar to the OpenJPA's Externalizer.
  • JPQL updates: New updates and enhancements are added to the JPQL.
  • TREAT Support: The support for TREAT (down casting) is added in JPA 2.1
  • Criteria API refactoring
  • Packaged scripts support: Now ddl-create-script, ddl-drop-script, ddl-load-script scripts can be used.
  • Schema generation: The Schema generation support is added which is similar to OpenJPA's capability
  • Annotation updates: Updates are made to the @Converter, @ForeignKey, @Index annotations
  • Managed and unmanaged data from NativeQueries updated
  • Entity graphs: The use of entity graphs in queries and find operations is added in JPA 2.1
  • Unsynchronized persistence contexts: The support for unsynchronized persistence contexts added in JPA 2.1
  • Stored procedure invocation: Now you can call stored procedures from your program using JPA 2.1
  • Support for injection into entity listener classes
  • Enhancements to the the Criteria API added
  • Enhancements to the mapping of native queries

New features of JPQL

  • Downcasting: Downcasting is very useful feature as it gives subclass-specific attributes. Now the queries can address partial entity hierarchies.
  • Outer joins with ON conditions: This is very useful features for Outer Joins
  • Database and vendor function invocation support: It supports for the invocations of the functions which are in the database.
  • Support for Stored procedures: You can call stored procedures using JQL
  • Bulk delete and update through criteria queries: Support for bulk updates and deletes are added to the JPA 2.1
  • Dynamically defined named queries: You can define the named query at runtime and register and then use later point of time.
  • Improved result mapping for native queries: Added for better performance and better results.

Benefits of JPA 2.1

  • It makes the application portable across JPA providers and databases
  • Easy development and maintenance of persistence layer of the applications.
  • It increases the developer productivity
  • Application is highly scalable and provides high performance using secondary-level cache
  • JPA 2.1 provides better performance and better results

Vendors supporting JPA 2.1

Currently following vendors are supporting JPA 2.1:

In this section you have learned the new features of JPA 2.1. Now you can proceed to read more JPA 2.1 tutorials.


Share on Google+Share on Google+

JPA 2.1 New Features

Posted on: November 28, 2013 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: JPA 2.1 New Features  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image