High-Performance Java Persistence Newsletter, Issue 51
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 which explains why performance engineering is not just about solving a few bottlenecks that APM (Application Performance Monitoring) tools have identified for you.
Speaking of performance, if you want to see a very efficient way to synchronize an application cache with the latest data that’s being changed in the database, then you should definitely read this article that I published on my blog.
If you’re using PostgreSQL, then you should definitely read this article, which provides a very thorough explanation of how the PreparedStatement
is executed behind the scenes.
Speaking of SQL query statement execution, when using SQL, the logical order of operation doesn’t follow the top-to-bottom order that you used when writing the SQL query. If you are curious about how relational database systems execute an SQL query, then check out this article.
Another great read was this article, which explains how ChessCraft migrated from MongoDB to PostgreSQL and managed to achieve better performance after the migration. I liked this article because I remember all the frenzy from early 2010 around NoSQL and how they were being advertised as delivering better performance and scalability. Ten years later, relational databases are still a much better choice for the vast majority of projects than many NoSQL databases.
Hibernate 6 brings many changes that you need to be aware of. One of those changes is the way that the default entity sequence is used. To cover this topic in detail, I published this article that you may find useful.
Another article worth reading is this one, which lists the pros and cons of various database systems that implement the MySQL wire protocol, meaning that they are compatible with all existing MySQL Drivers.
Best Tweets
Here are the best tweets I posted since the last newsletter:
IT Support pic.twitter.com/irlRfI5mOp
— Vlad Mihalcea (@vlad_mihalcea) May 21, 2023
The cloud provider does not like it when you Keep It Simple.
— Vlad Mihalcea (@vlad_mihalcea) May 7, 2023
The more resources your software project consumes, the happier the cloud provider is.
Answer: How to split read-only and read-write transactions with JPA and Hibernate https://t.co/4X6ZnI1oVQ pic.twitter.com/vTT2ZALNTQ
— Vlad Mihalcea (@vlad_mihalcea) May 22, 2023
Keyset Pagination with JPA and Hibernatehttps://t.co/Q43x2qo5qJ pic.twitter.com/Lb9ZnVCZcL
— Vlad Mihalcea (@vlad_mihalcea) May 22, 2023
⚙️ Adding a cache to your application is easy. Maintaining consistency with the database is hard.
— Vlad Mihalcea (@vlad_mihalcea) May 30, 2023
💡 In this article, you are going to see how you can detect record changes and fetch the cache entry directly from the DB.https://t.co/0cNe4oIwDR pic.twitter.com/YAAzUbjE3E
Project Releases
There were three releases for the Hypersistence Utils project:
Especially if you are using Hibernate 6, you should upgrade to using the 3.4 version of this library.
One of the most anticipated releases is Spring Boot 3.1, which adds support for Hibernate 6.2.
PostgreSQL 15.3 has been released, providing you with many fixes that are relevant if you’re using PostgreSQL 15. Check out the release notes for more details.

Get in touch with my latest articles!
StackOverflow Answers
The following StackOverflow answers have been trending since the last newsletter episode:
- Hibernate flush slowdown in AbstractFlushingEventListener
- How to query a nullable @OneToOne relationship with JPA
- How to INSERT using a SELECT in Hibernate
- How to fix the “No CurrentSessionContext configured” with Spring and Hibernate
- Hibernate JPQL is returning multiple results for a count(*) query