liveBook · Manning

One-to-one relationship

A one-to-one relationship is an association in which each instance of either entity type relates to at most one instance of the other type.

How 3 Manning books explain it

Grokking Relational Database Design

A one-to-one relationship is a relationship in which each entity instance is associated with at most one instance of the other entity in both directions.

How it is used
Uses maximum cardinality to model entity pairs where neither side connects to more than one instance.
How deep it goes
Explains maximum and minimum cardinalities, notation, foreign-key placement, and insertion constraints.
Examples
Uses department-manager and dealer-address relationships to illustrate one-to-one associations.
What you can do after
Apply it to choose cardinalities, place a foreign key, and adjust optionality for workable data entry.

Read how Grokking Relational Database Design explains one-to-one relationship →

Java Persistence with Spring Data and Hibernate epub

A one-to-one association is an association in which each entity instance is related to at most one instance of the other entity type.

How it is used
Models exclusive associations between entity instances when each side may reference at most one instance of the other.
How deep it goes
Compares component, shared-primary-key, foreign-key, and join-table mappings, including schema constraints and lazy-loading behavior.
Examples
Uses User–Address mappings, an optional Shipment–Item link, SQL schemas, repository interfaces, annotations, and persistence tests.
What you can do after
Apply it via JPA annotations or Spring Data JDBC mappings while selecting storage based on lifecycle, identity, and optionality.

Read how Java Persistence with Spring Data and Hibernate epub explains one-to-one relationship →

Django in Action

A one-to-one relationship is a relationship in which each record on one side corresponds to at most one record on the other side.

How it is used
Separates extra user data from account data while preserving one profile per user.
How deep it goes
Implements the model field, deletion behavior, admin integration, and migration workflow without exploring database internals.
Examples
Uses RiffMates UserProfile, musician profiles, controlled venues, stacked inlines, and the Django Admin user screen.
What you can do after
Apply it via Django ORM and Django Admin to attach one profile model to each user account.

Read how Django in Action explains one-to-one relationship →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.