views:

469

answers:

3

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.

+12  A: 

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).
Pascal Thivent
Nice overview. There was also something with 1:1 jointables. But I think you already covered it in the `@OneToOne`. The Bean Validation is by the way part of JSR-303 (JPA2 itself is JSR-317).
BalusC
@BalusC Thanks. And you're right, the wording about Validation was confusing. What's new in JPA 2.0 is the transparent support of Bean Validation, not Bean Validation itself. I hope it's more clear.
Pascal Thivent
A: 

Regarding this question, this link is maybe not 100% precise, but it's a very good source of information to start from.

landrain