Entity modelling
Entities have stable identity through changing attributes.
What it is
Entities have stable identity through changing attributes.
When to use it
Separate persistent entities from value objects and DTOs.
Syntax
User 1 -> many Accounts
Account 1 -> many TransactionsExample
User: id, email
Account: id, user_id, currency
Transaction: id, account_id, amount_cents, status, external_reference
Money value: amount_cents + currencyCommon mistakes
Do not use mutable email as an entity ID; distinguish an account from its balance value.