High-Performance Java Persistence Newsletter, Issue 12
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 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
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.
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!
The following StackOverflow answers have been trending over the past two weeks:
- How to split read-only and read-write transactions with JPA and Hibernate
- How to update a JSONB column in PostgreSQL using a Spring Data JPA Query
- PostgreSQL throws “column is of type
jsonbbut expression is of type
bytea” with JPA and Hibernate
- Routing Read-Write transactions to Primary and Read_only transactions to Replicas using Spring and Hibernate
- Hibernate Types framework throws “PSQLException: ERROR: cannot cast type
bigintto interval” when using the PostgreSQLIntervalType with a native SQL
- How to register a custom Hibernate ARRAY Type that handles both real and text array column types
- How can I implement I18n as a JSON object for a JPA or Hibernate entity?