Hibernate default entity sequence

Introduction In this article, we are going to see how the default entity sequence changes when migrating from Hibernate 5 to Hibernate 6.

The best way to generate a TSID entity identifier with JPA and Hibernate

Introduction In this article, I will show you the best way to generate a TSID entity identifier with JPA and Hibernate. Prior to continuing, if you are not familiar with the advantages of using compact Time-Sorted Identifiers, like TSID, check out this article first.

Scaling a Spring application with a YugabyteDB cluster

Introduction In this article, we are going to see that scaling the data access layer of a Spring application can be done very easily with a YugabyteDB cluster. As I explained in this article, YugabyteDB is an open-source distributed SQL database that offers all the benefits of a typical relational database (e.g., SQL, strong consistency, ACID transactions) with the advantages of a globally-distributed auto-sharded database system (e.g., NoSQL document databases).

From Hibernate Types to Hypersistence Utils

Introduction In this article, I explain why the Hibernate Types became Hypersistence Utils, and how you can migrate your old dependency to Hypersistence Utils 3.0.

Spring Data Hibernate Entity Listeners

Introduction In this article, we are going to see how we can configure Spring Data to register several Hibernate Entity Listeners that can intercept entity state modifications. As I explained in this article, JPA also offers an event listening mechanism that you can configure via the @EntityListeners, @PostPersist or @PostUpdate, or PostRemove annotations. However, the JPA solution is way too limited as it doesn’t allow you to interfere with the EntityManager directly. Therefore, I prefer using the Hibernate Entity Listeners mechanism, which you can easily integrate with Spring Data, as this article… Read More

The best way to use UNION, INTERSECT, and EXCEPT with Hibernate

Introduction In this article, we are going to see how we can write UNION, INTERSECT, and EXCEPT queries with Hibernate. While you could have always used all these relational set operations using native SQL queries, starting with Hibernate 6, you can use UNION, INTERSECT, and EXCEPT in JPQL and Criteria entity queries. This is all possible because of the new Semantic Query Model that Hibernate has introduced in version 6.

How to use different Java versions for main and test in Maven

Introduction In this article, we are going to see how we can use different Java versions for the main and test folders in Maven so that you can run tests on a newer version of Java.

The best way to map MonetaryAmount with JPA and Hibernate

Introduction In this article, we are going to see what is the best way to map the MonetaryAmount object from Java Money and the Currency API when using JPA and Hibernate. While the Java Money and Currency API define the specification, like the MonetaryAmount interface, the Moneta project provides a reference implementation for this API.

Java data access technology survey results

Introduction Java has tons of data access frameworks, and in this article, we are going to what Java database technology is preferred by developers and for what reasons. The number one reason why we have so many data access frameworks in Java is JDBC. JDBC was a remarkable achievement. Prior to JDBC, programming languages didn’t have a database communication abstraction that could allow one application to work with any relational database implementing the JDBC Driver specification. The fact that JDBC offered this unified abstraction allowed Java developers to create various data access… Read More

The best way to configure the Hibernate Dialect

Introduction In this article, I’m going to explain what is the best way to configure the Hibernate Dialect so that you get the most out of your database.