High-Performance Java Persistence Newsletter, Issue 12

Imagine having a tool that can automatically detect if you are using JPA and Hibernate properly. Hypersistence Optimizer is that tool!

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.

If you like this newsletter,

you are going to love the next episodes!

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.