Angular shitstorm: What's your opinion on the controversial plans for Angular 2.0?
JPA API making steady steps

JPA 2.1 Early Draft reveals Java EE 7 progress

Chris Mayer
java-logo1

The object/relation mapping JSR is shaping up nicely after one year on from the request being made

Over 12 months have passed since one of the first JSRs for Java EE 7 was filed and you’d be forgiven for missing some of the progress. An early draft was released a month ago, chronicling the steps that had been made towards JPA 2.1 – that aims to manage persistence with object/relational mapping. 

Fortunately, Java EE Evangelist Arun Gupta filled us all in on the progress that had been made towards getting the full spec for JPA 2.1. A lot of promises were made in the original draft and it is pleasing to see so many already part of the early draft, although some fall by the wayside as they were deemed unnecessary. Amongst the request from the community were the following, that would be assessed in the JSR:

  • Support for custom types and transformation methods.
  • Support for the use of “fetch groups” and/or “fetch plans” to provide further control over data that is fetched, detached, copied, and/or used in merging.
  • Support for the specification of immutable attributes and read-only entities.
  • Support for user-configurable naming strategies for use in O/R mapping and metamodel generation.
  • More flexibility in the use of generated values; support for UUID generator type.
  • Additional mapping metadata to provide better standardisation for schema generation.
  • And much more…

Gupta gave us the highlight reel from the draft, which included the following for JPA 2.1:

  • Support for Stored Procedures: Added support for the invocation of predefined database functions and user-defined database functions to the Java Persistence query language.

  • Bul update/delete using Criteria
  • New reserved keywords: Added the following to Java Persistence query language reserved identifiers:FUNCTIONONTREAT.
  • Entity listeners using CDI: Entity Listeners allow to handle cross-cutting lifecycle events in a non-persistent listener class. In JPA 2.1, entity listeners will support dependency injection through CDI. The usual lifecycle callback methods of @PrePersist@PostPersist@PreUpdate, and @PreRemove can be used for entities. The entity listeners can also be annotated with @PostConstruct and @PreDestroy for their own lifecycle. 
  • Synchronisation of persistence contexts: In JPA 2, the persistence context is synchronised with the underlying resource manager. Any updates made to the persistence context are propagated to the resource manager. JPA 2.1 introduces the concept of unsynchronised persistence contenxt. 

  • Several clarifications in text and javadocs

However some promises made within the original specification haven’t made the cut this time, notably multi-tenancy support which will be made available in later drafts. Given the amount of work needed to be done for this JSR, you can surely expect further features to be available down the line.

Even better news is that Arun will also profile the progress made in several other Java EE 7 specifications like JavaServer Faces 2.0JAX-RS 2.0CDI 1.1, more coming as well) and I’ll cover them in later blogs.

For a more in-depth look at what each feature can do, Arun Gupta provides perfect analysis of what is new within JPA 2.1. 

Author
Comments
comments powered by Disqus