views:

3297

answers:

3

Does anyone have a list of the changes between JPA 1 and JPA 2? I have read about the Criteria queries and other changes, but I would like a "what's new" kind of reference. Thanks

+6  A: 

Google returns many results, including this and this blog posts. The summary (copied from the former) is:

  • Added support for persistently ordered lists using OrderColumn and provider-managed ordering column
  • Defined support for foreign key mapping strategy for unidirectional one-to-many relationships
  • Added clear method to EntityManager interface to allow entities to be evicted from the persistence context; added CLEAR cascade option.
  • Added Cache interface.
  • Added support for pessimistic locking and new lock mode types.
  • Added overloaded find and refresh methods added to support locking with standardized and vendor-specific properties and hints.
  • Added standardized hint javax.persistence.lock.timeout for use in locking configuration.
  • Added the standardized properties javax.persistence.jdbc.driver, javax.persistence.jdbc.url, javax.persistence.jdbc.user, javax.persistence.jdbc.password for use in persistence unit and entity manager factory configuration.
  • Added Query getNamedParameters and getPositionalParameters methods.
ChssPly76
+1  A: 

JPA2 also adds typesafe query api. see http://www.ibm.com/developerworks/java/library/j-typesafejpa/

Miguel Ping
+2  A: 

There is also a pdf version of Mike Keith's presentation "What's New and Exciting in JPA 2.0" from Jazoon 2009.

Hardy