High-Performance Java Persistence Newsletter, Issue 11
Imagine having a tool that can automatically detect JPA and Hibernate performance issues. Wouldn’t that be just awesome?
Well, Hypersistence Optimizer is that tool! And it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, or Play Framework.
So, enjoy spending your time on the things you love rather than fixing performance issues in your production system on a Saturday night!
Introduction
Welcome to a new issue of the High-Performance Java Persistence Newsletter in which we share articles, videos, workshops, and StackOverflow answers that are very relevant to any developer who interacts with a database system using Java.
Articles
How many times did you want to know where a given slow SQL query comes from? Maybe it was generated by a JPQL query or a Criteria API query. The Java EE specification created this issue in 2012, and, unfortunately, it didn’t get into the JPA 2.1 or 2.2 spec.
So, to address this issue, I created an SQLExtractor
utility in the Hibernate Types project that allows you to fetch the SQL string from a given JPA Query
. For more details about this awesome feature, check out this article.
Franck Pachot wrote three very good articles since the last newsletter:
. If you’re using PostgreSQL, you know that the shared buffer size is limited since, unlike other relational database systems, PostgreSQL relies on the OS cache as well. In this article, Franck explains what you need to consider when sizing the shared buffer.
. The second article is about importing data from external files using Oracle. Importing data into tables and exporting it is a very useful feature, especially when dealing with high-volume data processing tasks.
. The third article is about auto-updated Oracle materialized views. Unlike PostgreSQL, which requires you to call REFRESH using triggers, Oracle can automatically update materialized views. Materialized views are useful when a given query is too expensive to execute on-demand, so storing its pre-computed result set is the only way to speed it out.
If you are using PostgreSQL, you should definitely know about the RETURNING clause. This article explains how you can optimize the performance of a batch processing task using this feature.
Apart from increasing availability, database replication allows you to scale traffic to multiple nodes. The single-primary replication is the most common strategy, and this article gives you a quick introduction to this topic.
MySQL 8.0.20 has been released at the end of April 2020, and it provides many enhancements, like HASH JOIN and double-write buffer. This presentation goes through all these new features, so it’s worth watching it.
Project releases
I released the 2.1.1 version of Hypersistence Optimizer. The goal of this release is to provide better support for older Java EE application servers, like JBoss 5 and 6. You will be surprised how many people are still developing legacy applications with 10 or 15-year-old technologies.
Hibernate ORM released the 5.4.17 version. For more details about this release, check out the announcement page.
The 2.9.11 version of the Hibernate Types project has arrived. A bug was fixed for Kotlin List and arrays, and the new SQLExtractor
utility was added as well.

Get in touch with my latest articles!
StackOverflow Answers
The following StackOverflow answers have been trending over the past two weeks:
- How does replication work in a distributed database
- What is the difference between JPQL, HQL and Criteria API when using JPA and Hibernate
- How to fix the “
@Column
not allowed on a@ManyToOne
property” issue - Is it worth using the Hibernate Bytecode Enhancement mechanism?
- In which case do you use the JPA @JoinTable annotation?
- Can I get the SQL string from a JPA Query object?
- How to convert HQL to SQL Query programmatically (without logging)