liveBook · Manning

Database access abstraction

As explained in Akka in Action, Second Edition

A software abstraction that isolates application logic from the details of database operations.

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

Figure 1.5 Data access objects
CH01_F05_Abraham2

Use the DAO diagram to trace how stateless application code delegates database work. section 1.4.1

How Akka in Action, Second Edition covers it

How deep it goes
Explains DAO and controller roles, then identifies failure, coordination, consistency, and testing consequences without detailing an implementation.
Examples
Uses Conversation and Message inserts, addMessage failures, duplicate records, and DAO interaction diagrams.
What it assumes
Assumes familiarity with in-memory objects and web servers while contrasting them with statelessness, DAOs, controllers, and database calls.
What you can do after
Evaluate database-backed object replacements by identifying failure handling, coordinated writes, consistency, and testing requirements.
How it connects
Connects statelessness with data access objects, controllers, database operations, concurrency, and load balancing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Akka in Action, Second Edition. The section links point to the parts of the book it draws on.