Skip to main content

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:

  1. A unique identifier: distinguishes the entity from others, even if the data matches.
  2. State and behavior: holds data and the rules for changing it.
  3. 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 ready
Premium

A concise answer to help you respond confidently on this topic during an interview.