The best way to use the JPA OneToOne optional attribute
Introduction In this article, we are going to see what is the best way we can use OneToOne optional attribute so that we can avoid N+1 query issues.
How to use Java Records with Spring Data JPA
Introduction In this article, we are going to see how we can use Java Records with Spring Data JPA Repositories. As I already explained, Java Records cannot be used as JPA entities since the Records are immutable, and JPA requires the entity class to have a default constructor and be modifiable, as that’s how the entity properties are populated when the entity is being fetched from the database. For this reason, this article will show you how to combine Java Records and JPA entities so that you get the best out of… Read More
Fetching recursive associations with JPA and Hibernate
Introduction In this article, we are going to see how to fetch recursive associations when using JPA and Hibernate. Recursive table relationships are built using self-referencing Foreign Key columns so that a record in a table can reference another record in the very same table, therefore allowing us to represent hierarchical structures using the relational model.
The best way to map multiple entities on the same table
Introduction In this article, we are going to see what is the best way to map multiple entities on the same table. There are several advantages to mapping multiple entities on the same database table: To avoid loading large columns (e.g., JSON) To avoid N+1 query issues for bidirectional @OneToOne associations Before we start investigating the best way to map multiple entities on the same table, if you wonder why you even need to use one-to-one table relationships, then check out this article first.
Spring Load-Time Weaving
Introduction In this article, we are going to see how Spring load-time weaving works so that you can apply the Hibernate bytecode enhancement mechanism at runtime. Traditionally, the bytecode enhancement mechanism is applied when the project is built using a Maven or Gradle plugin. For more details about the build-time approach, check out this article.

