A concise, clear list of what is new in JPA2?
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 actu开发者_StackOverflow社区al spec.
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).
精彩评论