Cheat Sheet: New Features in JPA 2.1

JPA 2.1 introduced 12 new features, like StoreProcedureQueries, Entity Graphs and Attribute Converter, to make your work with the database easier and more efficient.
Download your free New Features in JPA 2.1 cheat sheet now, to get all the information you need to improve your database access.

This 5 page cheat sheet brings you:

- a short description and
- code snippets for each feature,
- links to more detailed articles.

Signup now and get your free New Features in JPA 2.1 cheat sheet and regular blog updates.

I respect your privacy and have ZERO TOLERANCE for spam!

Result Set Mapping: Constructor Result Mappings

This is the third part of my series about SQL result set mappings:
In the first post of this series, we had a look at some mapping definition between the query result and one entity. The mapping definitions got more complex in the second part, as we mapped the query result to multiple entities and handled additional columns. 
In this post, we will have a look at the Constructor Result Mappings introduced in JPA 2.1. This feature allows us to call the constructor of a value object with the result of the query, similar to the JPQL constructor expressions. This is often used, if we want to provide a specific view of our domain model to the client.

Java Weekly 17/15: Java stats, caching and JPA productivity

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Result Set Mapping: Complex Mappings

This is the second part of my SQL result set mappings series. We had a look at some basic result type mappings in the first post Result Set Mapping: The Basics. In this one, we will define more complex mappings that can map a query result to multiple entities and handle additional columns that cannot be mapped to a specific entity.
  • Result Set Mapping: The Basics
  • Result Set Mapping: Complex Mappings
  • Result Set Mapping: Constructor Result Mappings (coming soon)
  • Result Set Mapping: Hibernate specific features (coming soon)

Java Weekly 16/15: Microservice design patterns, scopes for JBatch, Java 8 concurrency, IoT with Java ME 8 and more

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.


Result Set Mapping: The Basics

Quite often JPQL is not powerful enough to perform the queries we need in real world projects. In general, this is not an issue because JPA is designed as a leaky abstraction and we can use the full potential of SQL by using native queries or calling stored procedures.
The only downside is, that these queries return a List of Object[] instead of the mapped entities and value objects we are used to work with. Each Object[] contains one record returned by the database. We then need to iterate through the array, cast each Object to its specific type and map them to our domain model. This creates lots of repetitive code and type casts as you can see in the following example.


It would be more comfortable, if we could tell the EntityManager to map the result of the query into entities or value objects as it is the case for JPQL statements. The good news is, JPA provides this functionality. It is called SQL result set mapping and we will have a detailed look at it during this series:
  • Result Set Mapping: The Basics
  • Result Set Mapping: Complex Mappings
  • Result Set Mapping: Constructor Result Mappings (coming soon)
  • Result Set Mapping: Hibernate specific features (coming soon)

Java Weekly 15/15: GC tuning, HTTP2, good Javadoc, MVC 1.0 early draft

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Java Weekly: April Fools Edition

Normally, I am using the Java Weekly series to collect the most interesting Java related links. But today I prepared a special April Fool Edition for you. I hope you enjoy it.



Java Weekly 14/15: log4j memory leaks, JBatch monitoring and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



My Trip to JavaLand 2015

Last week, I attended the JavaLand 2015 conference in Brühl, Germany. If you follow me on twitter, you have probably seen me tweeting about it. And what shall I say, it was a great conference! Well organized, lots of interesting sessions, great discussions and everything happening in a theme park. Yes, that's right: it took place in the Phantasialand theme park!

And did I already mention that I hosted a Java quiz as one of the community activities? :-D

Java Weekly 13/15: JCache, RESTful conversations, Java EE Management and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Java Weekly 12/15: CDI, templating in MVC, Keycloak, recorded sessions and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



How to activate Hibernate Statistics to analyze performance issues

Did you ever ask yourself why a server request took ages on the production system while your local test system was just fine?
Well, we all had these situations and we will have several more of them in the future. In my experience, strange performance drops are often related to slow database queries. But which query causes the problem? And how to find it, if you can't or don't want to activate logging on your database?

The good news is, there is an easy way to do it. Hibernate can be configured to collect statistics and to provide the required information to analyze the database queries. So lets see what we need to do.


Java Weekly 11/15: Java Money, REST API evolution, CDI 2.0 and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Java Weekly 10/15: Java Threads, lock modes, JAX-RS caching and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Java Weekly 9/15: Reflection, a Java 8 pitfall, Flyway, MVC and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.




JPA 2.1 - 12 features every developer should know

If you are a regular reader of this blog, you know that I wrote several articles about features and enhancements introduced with JPA 2.1. One thing that was missing, was a general overview about all the changes. So here it is :-)
The following paragraphs provide a description of the 12 features and enhancements introduced with JPA 2.1. And as a special bonus, I created a cheat sheet with a short description and additional code snippets for each change, which you can download for free.


Java Weekly 8/15: Docker, JVM mysteries, a dynamic scripting lib and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.




Java Weekly 7/15: Clustering WebSockets, Batch API Lab, Valhalla and more...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.



Java Weekly 6/15: Micro Benchmarking, NoSQL with Hibernate, Horror Stories and more ...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.




Java Weekly 5/15: CDI in Java SE, DeltaSpike, James Gosling and more ...

The Java world is evolving at a rapid pace and it can be challenging to keep track of it. Fortunately lots of great resources are created every week, explaining new features or looking at existing stuff from a different angle.

I am using the Java Weekly series to collect the most interesting links I found during the last week and present them to you all in one place. I hope you find it useful and that it makes it easier for you to keep up-to-date. If you like to suggest a resource or something I can improve on, please leave me a comment.