Glassfish 5 Build 11 is now available – with support for many of the Java EE 8 specifications e.g. JAX-RS 2.1, JPA 2.2, JSON-B 1.0 etc. For more details check out the Aquarium space. This blog covers
- test driving couple of new additions in this build – JSON-B 1.0 and JPA 2.2
- we run this in a container, thanks to the Glassfish 5 nightly Docker image
Application
It’s a simple one – available on Github
- Has a REST endpoint (also a
@Stateless
bean) - Interacts with an embedded (Derby) DB using JPA – we use the
jdbc/__TimerPool
present in Glassfish to make things easier - Test data is bootstrapped using standard JPA features in
persistence.xml
(drop + create DB along with a SQL source)
JSON-B 1.0 in action
Primarily makes use of the JSON-B annotations to customize the behavior
@JsonbProperty
to modify the name of the JSON attribute i.e. its different as compared to the POJO field/variable name@JsonbPropertyOrder
to specify the lexicographical reverse (Z to A) order for JSON attributes
For more, check out Yasson which is the reference implementation
JPA 2.2 in action
The sample application uses the stream result feature added to Query
and TypedQuery
interfaces by which it’s possible to use JDK 8 Streams API
to navigate the result set of a JPA (JPQL, native etc.) query. For other additions in JPA 2.2, please check this
Run on Docker and test…
Check the README
Cheers!
Nice blog with excellent information. Thank you, keep sharing.
LikeLike