adam bien's blog

JPA 2.0 update from JavaONE - important improvements 📎

Some new features of JPA 2.0:
  • JPA 2.0 Spec will be decoupled from EJB 3.0
  • Better support for embaddable classes
  • Better validation support (private @Length(5), @Max(2), @Required - perhaps in align with JSR-303)
  • Support of collections of basic types Set<String>
  • Support for Mapped Superclasses for Embeddables (so the state of a super Embeddable can be subclassed)
  • Support for ordered lists - the order of the items should remain persistent
  • The access strategy will be extended so in one entity several access types can be used. For this purpose a new Annotation e.g. @AccessType(PROPERTY|FIELD) might be used.
  • @OneToMany mapping is going to be extended, so that the natural way of modelling FKs in the target table will be mandatory (in JPA 1.0 it is optional).
  • Expanded support for O/R Mapping - Table per concrete class strategy is going to be mandatory
  • In JPA 1.0 all queries are polymorphic, in JPA 2.0 there will be a restriction in place
  • JPA 2.0 will support criterias - instead of string concatenation there will be a more fluent way  to define queries
  • The HashMap like hints (e.g. logging, caching) are going to be standardized
  • Standardization of the Unfetched State (now it is undefined what happens)
  • EntityManager could be joined to an existing transaction (e.g. with a method joinTransaction())
JPA 2.0 is scheduled together with JavaEE 6.