High-Performance Java Persistence Newsletter, Issue 25
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 how you can speed up a slow JOIN query using UNION ALL to concatenate the result sets of two faster queries.
If you’re experiencing deadlock issues when using SQL Server and want to investigate what statements are causing those deadlocks, you can use trace flags to instruct the database engine to print the deadlock info in the error log. For more information about this technique, check out this article.
If you are using MySQL and you want to learn how each isolation level prevents data anomalies, then this article is surely going to help you get a better understanding of this topic.
Concurrency control is very important for data integrity, and, for this reason, you can use either optimistic or pessimistic locking. If you’re wondering when to use each of these techniques, then check out this article I wrote on my blog.
Upgrading a very large database from one version of PostgreSQL to another is a very challenging task. Luckily, the software engineers at Adyen have shared their experience in this blog post, which we can all use as a reference the next time we need to achieve this goal.
When mapping Hibernate entities, you are also defining the default fetch plan, which governs how entities are fetched upon executing a find
method or an entity query. Understanding how the default fetch plan works is very important for application performance, and, for this reason, this article is worth reading.
Best Tweets
Here are the best tweets I posted since the last newsletter:
The struggle is real 😀 pic.twitter.com/6bz6BGZDTD
— Vlad Mihalcea (@vlad_mihalcea) March 27, 2021
Getter and setter Javadoc comments pic.twitter.com/pOlludPXAW
— Vlad Mihalcea (@vlad_mihalcea) March 21, 2021
If you want to become a better software developer:
— Vlad Mihalcea (@vlad_mihalcea) March 30, 2021
✅ Read everyday.
✅ Never stop learning.
✅ Teach others what you know.
✅ Build stuff because execution beats knowledge.
In software development, complexity might be admired, but simplicity is always rewarded.
— Vlad Mihalcea (@vlad_mihalcea) March 17, 2021
A software bug is only the effect.
— Vlad Mihalcea (@vlad_mihalcea) March 13, 2021
The real cause is lack of testing.
Project Releases
The Hibernate ORM project released the 5.4.30 version.
I’m proud to announce to you the 2.10.4 version of the Hibernate Types framework has been released. For more details about this release, check out the closed issues section.
The 9.2 version of SQL Server JDBC Driver has been released. If you want to learn more about this release, then check out this article.

Get in touch with my latest articles!
StackOverflow Answers
The following StackOverflow answers have been trending over the past two weeks:
- How can I make a JPA
@OneToOne
relation lazy - What is the difference between Non-Repeatable Read and Phantom Read?
- SQL NOT IN vs. NOT EXISTS
- How to map calculated properties with JPA and Hibernate
- What’s the advantage of finding an entity using the Hibernate
@NaturalId
- How to optimize a JPQ JOIN query to run faster