High-Performance Java Persistence Newsletter, Issue 32
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
The pick of this edition is this article about extracting the PostgreSQL planner to a standalone library so that it can be used to generate plans without requiring a running PostgreSQL instance.
If you’re using JPA and Hibernate, you surely heard about the first and the second-level cache. If you wonder what those two caches mean or why would you need them, then check out the following two articles:
One article I liked very much is this one about MySQL replication best practices.
A great addition to the Hibernate Types library is the Batch Sequence Generator. If you wonder how it works and why you should use it, then check out this article.
If you’re using PostgreSQL, you should pay attention to the work_mem
setting, as if it’s too low, it can cause a SELECT query to write to the disk the temporary tables used for sorting or hash joining or hash aggregating. For more details about this setting, check out this article.
The Hibernate Types library is surprisingly flexible and supports various JSON mappings I didn’t even try previously. For instance, if you want to map polymorphic JSON objects with Hibernate, you can surely do that. Check out this article for more details about this topic.
Best Tweets
Here are the best tweets I posted since the last newsletter:
Preparing your trivial project for Big Data because Google and Netflix also had this problem. pic.twitter.com/zBrVcUTnri
— Vlad Mihalcea (@vlad_mihalcea) October 15, 2021
Software developers are forever students
— Vlad Mihalcea (@vlad_mihalcea) October 19, 2021
Not using database-specific features in the name of portability is a very common mistake.
— Vlad Mihalcea (@vlad_mihalcea) October 31, 2021
Database portability makes sense for frameworks or template products. End products rarely switch DBs. I only had to do that twice in 17 years.
In software, Simple is better than Smart.
— Vlad Mihalcea (@vlad_mihalcea) October 27, 2021
Spending a fortune on Amazon RDS running highly inefficient SQL queries can save you hours of reading the database manual.
— Vlad Mihalcea (@vlad_mihalcea) October 6, 2021
Project Releases
MySQL 8.0.27 has been released. One of the major addition is the InnoDB CLusterSet that provides disaster tolerance for InnoDB clusters.
A new setting offered by MySQL 8.0.27 is innodb_ddl_threads
, which controls the number of threads used to load and sort data when doing an online DDL operation.
The EXPLAIN FORMAT=TREE
now indicates whether an index is covering the query, making it easier to understand how the index is being used.
The Connector/J MySQL JDBC Driver also released a matching 8.0.27 version.
Hibernate ORM 5.6.0 was released. With the release, the 5.5 branch is going into maintenance mode only.
The 42.3.1 and 42.3.0 versions of the PostgreSQL JDBC Driver have been released, providing several bug fixes.

Get in touch with my latest articles!
StackOverflow Answers
The following StackOverflow answers have been trending over the past two weeks:
- Trigger for checking a given value before INSERT or UPDATE on PostgreSQL
- How to use multiple JOIN FETCH in one JPQL query
- How to prevent SQL Injection with JPA and Hibernate?
- What is the Java annotation in Hibernate used to auto-increment a MySQL Primary Key –
@Id
- Mapping JPA or Hibernate projection query to DTO (Data Transfer Object)