Design patterns·Objects and the database between them
you loaded the same customer twice in one request and got the same object, not two equal ones.
Identity map
Also calledidentity map pattern, first-level cache, session cache
A per-transaction map from database identity to loaded object, so a row read twice produces one instance. It removes a whole class of bug where two copies of the same record drift apart, and it makes reference equality meaningful within a unit of work. It also explains a common confusion: a second query for a row already loaded may return the in-memory version, complete with your uncommitted changes.