Hypersistence Optimizer Review – detect JPA & Hibernate improvements

Last Updated:  August 30, 2021 | Published: December 19, 2019

Recently I got the chance to review Vlad Mihalcea's Hypersistence Optimizer. It…

checks your JPA and Hibernate mappings and provides you tips about how you can optimize your application

For evaluating this tool I picked one of the main applications (Spring Boot 2.1 and Java 8) of my current project. With this blog post, I'll share my review with you.

TL;DR:

  • simple to use and integrate
  • book Vlad Mihalcea's in-depth JPA & Hibernate knowledge as a service with this tool
  • automate the process of finding JPA & Hibernate code smells in your application

Project setup for the Hypersistence Optimizer

Vlad distributes the library via his teachable site. Once you buy your license, you get access to a new course and can download the hypersistence-optimizer-pack.

Next, you have to unzip the content and install the content in your local Maven repository. Vlad provides a shell and batch file for this:

Once the Hypersistence Optimizer is available in your local Maven repository, you can start using it:

Analyzing the application's JPA & Hibernate setup

There are multiple ways to get the output of the Hypersistence Optimizer. If you are using Spring Boot with Spring Data JPA, you can create the following component, which will run after your Spring Boot application starts:

You can also write an integration test and get the Hypersistence Optimizer output while executing it:

Make sure to use the same database (e.g. no H2) and the same Hibernate configurations as in production. Otherwise, the suggestions might not help that much. A development environment might be a good fit for this.

Once you run your application or execute the test, the Hypersistence Optimizer will print all findings with an indicator for its importance (BLOCKER, CRITICAL, MAJOR, MINOR)

For those of you who are using WildFly with Java EE or Jakarta EE, a simple setup can look like the following:

Unfortunately, you can't use it for applications running on Payara or Open Liberty (without configuring the JPA provider manually) as they use EclipseLink for the JPA implementation.

Summary of the Hypersistence Optimizer

I've tested it for one of my current applications and the suggestions/findings were really helpful. The result of the first run was the following:

Most of the issues for this application where about fetching strategies and enum handling. Once I fixed one of the issues I was able to get instant feedback as I can re-run my Hypersistence Optimizer check. This allows you to tackle each individual suggestion step-by-step with short feedback cycles.

In conclusion, Hypersistence Optimizer is simple to use and integrate. Each warning comes with a link to a detailed description that contains a detailed blog post from Vlad. Furthermore, it provides great optimization support and inverts the process of fixing JPA & Hibernate issues as the tool tells you right-before where the root cause might be.

With this tool, you are able to book Vlad's in-depth JPA & Hibernate knowledge as a service. Knowing all JPA & Hibernate pitfalls is hard but with the Hypersistence Optimizer, you can automate the process of finding JPA & Hibernate code smells in your application.

Find further resources on Hypersistence Optimizer here:

For more input on High-Performance Java persistence, have a look at Vlad's excellent online course.

PS: There is also a trial version available and you can find the source code for this Hypersistence Optimizer review on GitHub.

Have fun using the Hypersistence Optimizer,

Phil

>