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
andFIELD
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
andCriteriaQuery
for programmatic construction of type-safe queries. - API additions - Additional API on
EntityManager
(supported properties,detach
method, etc) andQuery
(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
2010-03-13 23:35:46
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
2010-03-14 05:05:43
@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
2010-03-14 06:18:47