Differences between JPA and JPA2

Guillermo Vasconcelos picture Guillermo Vasconcelos · Aug 27, 2009 · Viewed 39.7k times · Source

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

Answer

ChssPly76 picture ChssPly76 · Aug 27, 2009

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.