~/devreads

#onetoone

3 posts

24 Apr 2024

vladmihalcea 1 min read

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. One-To-One table relationship As I explained in this article, in a one-to-one table relationship, the parent and the child tables share the Primary Key column values because the child table Primary Key…

hibernateonetoonebidirectionaljpaoptional

15 Dec 2023

vladmihalcea 1 min read

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…

hibernateonetoonejpamultiple entities

14 Jun 2023

vladmihalcea 1 min read

Introduction In this article, we are going to see what is the best way to use one-to-one table relationships. I decided to write this article after reading this Tweet: One-to-one table relationships As I explained in this article, a relational database system defines three table relationship types: one-to-many one-to-one many-to-many The one-to-one table relationships rely on the fact that both…

hibernatesqlonetooneone-to-onetable relationship