A database access abstraction replaces feature-rich in-memory objects with a boundary around database operations. Data access objects execute statements, while controllers retain the business logic. section 1.4.1
The pattern supports stateless web servers behind a load balancer, but turns ordinary method calls into operations that can fail because of insert errors, database outages, or network problems. section 1.4.1
Adopting the abstraction changes several responsibilities:
- Handle failed database calls instead of relying on the reliability of in-memory methods. section 1.4.1
- Coordinate related operations, such as inserting Conversation and Message rows when starting a conversation. section 1.4.1
- Protect against duplicate records and inconsistent data under concurrent use. section 1.4.1
Conversation creation
A controller handling “start conversation” delegates to DAOs that insert rows in the Conversation and Message tables, then must account for either operation failing. section 1.4.1
Use the DAO diagram to trace how stateless application code delegates database work. section 1.4.1
