Linda DeMichiel writes about the improvements incorporated into the Java Persistence 2.0 spec.
For those of you who are not already familiar with JSR 317 and some of the areas we're planning to address, these are some of the highlights of the JSR-317 agenda: * Expanded O/R mappings * Improved domain modeling capabilities * Additions to the Java Persistence query language * An API for criteria queries * Standardization of configuration hints * Additional contracts for detached entities and extended persistence contexts * Support for validation via integration with the work of JSR 303 Here are some of the highlights of what we've added in terms of O/R mapping and domain modeling improvements: Better support for modeling using common Java language datatypes, including embeddable types (e.g., non-entity dependent object types such as Address) and collections of basic types such as String, Integer, etc. In Java Persistence 1.0, explicitly-mapped collection types (i.e., collections that could be mapped into their own relational tables) were limited to entities, and you either had to store collections of embeddables and basic types in serialized form or rely on vendor-specific metadata. For embeddable types, in additional to support for collections of embeddables, we've also added support for multiple levels of embedding and for the use of relationships in embeddable classes. Another frequently requested feature has been support for persistently ordered lists. Java Persistence 1.0 supports the use of a @OrderBy functionality that allows you to retrieve relationships that are ordered by various attributes as they are retrieved from the database. This is a very natural approach from a relational point of view. However, in Java Persistence 2.0 we've also added an @OrderColumn which the persistence provider must use to maintain whatever ordering you assign. While some of us have a few misgivings about this feature from a database point of view, we have received so many requests for it that we have now added it to the spec. We've also made support for Maps much more general. In Java Persistence 1.0, the value of a map needs to be an entity and the key either its primary key or another of its attributes. In Java Persistence 2.0, the map key and map value can each independently be a basic type, an embeddable, or an entity. This therefore gives support for the modeling of ternary relationships in the database as well as for association tables with additional state.
Read Linda DeMichiel's complete post: