What is an entity?
An Entity is a domain object defined not by its fields, but by its identity (ID), and it has a lifecycle.
Main traits:
- A unique identifier: distinguishes the entity from others, even if the data matches.
- State and behavior: holds data and the rules for changing it.
- A lifecycle: it is created, modified, deleted, and can migrate between systems.
Example:
User(id=42, name="Maria") is still the same entity even if the name changes.
The point: an Entity models things that have a history: people, orders, accounts, documents.
Short Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.