29

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.

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
benstpierre
  • 32,833
  • 51
  • 177
  • 288

1 Answers1

41

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
  • 562,542
  • 136
  • 1,062
  • 1,124
  • 1
    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 Mar 14 '10 at 05:05
  • @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 Mar 14 '10 at 06:18