High-Performance Java Persistence Newsletter, Issue 56

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!


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.


The pick of this edition is this article about MySQL 8.2 automatic read and write routing. Until MySQL 8.2 is released, if you’re using Spring, then you can check this strategy instead.

Speaking of Spring, if you’re using Stream query results, then check out this article that explains how to set the Statement fetch size when streaming the query result set.

When using JPA and Hibernate, you can use the CascadeType.REMOVE mechanism to make sure that the child entities are removed prior to deleting a parent entity. However, this works for bidirectional @OneToMany or @OneToOne associations but not for unidirectional ones. Therefore, if you have only unidirectional @OneToMany or @OneToOne associations and want to cascade the DELETE from parent to child entities, then check out this article.

The JPA IDENTITY strategy prevents the automatic batch insert mechanism because the INSERT is generated right away during the persist call, instead of being delayed until the Persistence Context is flushed. However, if you’re using MySQL and you don’t have support for database sequences, then you can use this trick to batch INSERT statements.

4-day High-Performance Java Persistence online training

Between the 20-21 and 22-23 of November, from 09:00 to 13:00 CET (Central European Time), I’m going to run a new session of my High-Performance Java Persistence online training.

During these 4 days, we are going to cover the entire agenda of the High-Performance Java Persistence training.

Here’s a list of things that we are going to dive into:

  • How to test your data access layer
  • Logging best practices
  • Connection management and monitoring
  • Mapping best practices (entities, associations, inheritance)
  • Persistence Context and entity state transitions
  • Batch processing
  • Statement caching
  • Fetching best practices
  • Caching best practices
  • Transactions and Concurrency Control

If you are using JPA and Hibernate, then you should definitely join this training, as it will help you get the most out of your relational database system.

Best Tweets

Here are the best tweets I posted since the last newsletter:

Project Releases

MySQL 8.0.35 has been released, and it provides several bug fixes for the MySQL 8 version.

The 12.4.2 version of the SQL Server JDBC Driver has been released, fixing one issue related to the JVM vendor.

The Hibernate ORM project has released the first candidate release for the 6.4 version, adding native support for soft deletes, HQL array functions, as well as support for Java Flight Recorder (JFR) for the SessionEventListever events.

The 3.6 version of Hypersistence Utils has been released with several improvements for the QueryStackTraceLogger.

Get in touch with my latest articles!

StackOverflow Answers

The following StackOverflow answers have been trending since the last newsletter episode:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.