High-Performance Java Persistence Newsletter, Issue 12

Are you struggling with performance issues in your Spring, Jakarta EE, or Java EE application?

Imagine having a tool that could automatically detect performance issues in your JPA and Hibernate data access layer long before pushing a problematic change into production!

With the widespread adoption of AI agents generating code in a heartbeat, having such a tool that can watch your back and prevent performance issues during development, long before they affect production systems, can save your company a lot of money and make you a hero!

Hypersistence Optimizer is that tool, and it works with Spring Boot, Spring Framework, Jakarta EE, Java EE, Quarkus, Micronaut, or Play Framework.

So, rather than allowing performance issues to annoy your customers, you are better off preventing those issues using Hypersistence Optimizer and enjoying spending your time on the things that you love!

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 newsletter is this article by Maciej Walkowiak, who explained how he created the amazing vlad-cli tool.

Database replication provides fault-tolerance, so, if the Primary node goes down, a Replica can take its place without losing availability. Apart from fault-tolerance, replication can also help us scale an application since it provides more nodes to serve traffic. If you want to learn how you can redirect read-only transactions to Replica nodes while read-write transactions are executed on the Primary node when using Spring, then you should definitely read this article.

A very interesting read is this article about MySQL prepared statements and how a ; ending character can prevent the driver from using server-side prepared statements.

Kyle Kingsbury, who’s the author of Jepsen, took the time to check if PostgreSQL 12.3 Serializable Snapshot Isolation really offers transaction schedules that are equivalent to some serial execution. Jepsen proved that the PostgreSQL Serializable isolation level allows write-skews-on-disjoint-reads anomaly.

While the JPA Query interface is sufficient for many use cases, sometimes you need to unwrap it to the Hibernate-specific org.hibernate.query.Query interface so that you get access to various methods, like the setParameter variant that allows you to pass the associated Hibernate Type to handle a given column type. For more details about this topic, check out this article.

Setting a timeout threshold for queries is very important since it allows you to roll back a long-running transaction that the user wouldn’t probably wait for it to finish anyway. This article explains how you can configure the session_timeout threshold either globally or on a per-session basis.

Project Releases

The 2.9.12 version of the Hibernate Types project has arrived.

This release brings several improvements to the Guava Range Type, as well as some fixes for Spring Boot applications.

Get in touch with my latest articles!

StackOverflow Answers

The following StackOverflow answers have been trending over the past two weeks:

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.