Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A concise, clear list of what is new in JPA2?

Does anybody know of a good list of what is new in JPA 2? Not what is new with Hibernate/TopLink in the version that supports JPA 2 but what is new in the actual spec.

like image 514
benstpierre Avatar asked Mar 12 '10 19:03

benstpierre


People also ask

What is jpa2?

JPA 2.0: A Java Persistence Update Covers JDBC Properties, Access Mode, Mappings, Shared Cache, the TypedQuery interface, JPQL, Pessimistic Locking, the Criteria API and Validation.

What is the latest version of JPA?

Jakarta Persistence 3.0 The JPA was renamed as Jakarta Persistence in 2019 and version 3.0 was released in 2020.

What is Persistence in Java?

Data Persistence is a means for an application to persist and retrieve information from a non-volatile storage system. Persistence is vital to enterprise applications because of the required access to relational databases.

What are JPA implementations?

JPA Implementation JPA describes relational data management in Java application. It is a specification and there are a number of implementations of it. Some popular implementations are Hibernate, EclipseLink, and Apache OpenJPA. JPA defines the metadata via annotations in Java classes or via XML configuration files.


1 Answers

The link mentioned in the accepted answer doesn't say anything about the second level cache so I decided to post a quick list to summarize "What's new in JPA 2.0 (JSR-317)":

  • Standard properties for persistence.xml - E.g. javax.persistence.jdbc.driver, etc instead of persistence provider specific properties.
  • Mixed Access Type - PROPERTY and FIELD access type can be mixed in a hierarchy and combined in a single class.
  • Derived Identifiers - Identifiers can be derived from relationships.
  • @ElementCollection, @OrderColumn - For better collection support.
  • Unidirectional @OneToMany / @OneToOne - For expanded mappings.
  • Shared Cache API - Second level caching in JPA, yeah!
  • Locking - Support for pessimistic locking added.
  • Enhanced JP QL - Timestamp literals, non-polymorphic queries, collection parameter in IN expression, ordered list index, CASE statement.
  • Expression and Criteria API - QueryBuilder and CriteriaQuery for programmatic construction of type-safe queries.
  • API additions - Additional API on EntityManager (supported properties, detach method, etc) and Query (query hints).
  • Validation - Transparent support of Bean Validation (JSR-303) if provider is present. (Validation is optional, the JPA 2.0 spec does not require a Bean Validation implementation).
like image 194
Pascal Thivent Avatar answered Oct 18 '22 09:10

Pascal Thivent