Spring Boot performance monitoring

Introduction To ensure that your Spring Boot application fulfills the SLA (Service Level Agreement) requirements, you need a performance monitoring tool. In this article, I’m going to show you how you can monitor the data access layer of a Spring Boot application using Hypersistence Optimizer.

The best way to prevent JPA and Hibernate performance issues

Introduction In this article, I’m going to present the best way to prevent performance issues when using JPA and Hibernate. Many years ago, I used to work as a team leader, and, one day, the General Manager asked me to take a look at a project that was in big trouble. The application in question had been developed by a team of software developers for over 9 months, and the client had just tested in a production-like environment. The client got very upset when realizing that the application was barely crawling. For… Read More

How to optimize JPQL and Criteria API query plans with Hibernate Statistics

Introduction Every entity query, be it JPQL or Criteria API, needs to be parsed and compiled to an AST (Abstract Syntax Tree) in order to generate the associated SQL query. The entity query compilation takes time, as explained in this article so Hibernate provides a QueryPlanCache to store already-compiled plans. Starting with Hibernate 5.4, the Hibernate Statistics mechanism allows you to monitor the Query Plan Cache and this article will show you how to take advantage of this feature to speed up IN query performance. For an introduction about the Hibernate Statistics… Read More

PostgreSQL SERIAL or IDENTITY column and Hibernate IDENTITY generator

Introduction When using PostgreSQL, it’s tempting to use a SERIAL or BIGSERIAL column type to auto-increment Primary Keys. PostgreSQL 10 also added support for IDENTITY, which behaves in the same way as the legacy SERIAL or BIGSERIAL type. This article will show you that SERIAL, BIGSERIAL, and IDENTITY are not a very good idea when using JPA and Hibernate.

How does Hibernate handle JPA Criteria API literals

Introduction The JPA specification is like a Java interface, However, when it comes to performance, implementation details matter a lot. That’s why, even if you use the JPA standard, you still need to know how the underlying provider implements the standard specification. For instance, if we take this tweet from Gareth Western: We can clearly see that there is an issue in the way literals might be handled by Hibernate when executing a Criteria API query. Therefore, in this article, we are going to see how literals are handled by Hibernate and… Read More

What’s new in JPA 2.2 – Stream the result of a Query execution

Introduction In this article, we are going to see how the JPA 2.2 Stream query results are supported by Hibernate and the caveats of using database cursors just to limit the amount of data that needs to be fetched.