Data access object
A data access object is a component that encapsulates operations for accessing and manipulating data in a persistent store.
Java Persistence with Spring Data and Hibernate epub
The data access object pattern separates an abstract data-access interface from the implementation details of communicating with a database.
- How it is used
- Uses DAOs to structure Java persistence applications with Spring and JPA or Hibernate.
- How deep it goes
- Develops entity-specific interfaces and Spring JPA implementations, then outlines generic base classes and Hibernate integration.
- Examples
- Uses Item and Bid entities with separate DAO interfaces, implementations, and entity-specific lookup methods.
- What you can do after
- Build a Spring JPA DAO from an interface and EntityManager-based implementation, and evaluate generated Spring Data JPA repositories as an alternative.
Read how Java Persistence with Spring Data and Hibernate epub explains data access object →
Test Driven: Practical TDD and Acceptance TDD for Java Developers
A data access object encapsulates access to a data source behind an interface used by application code.
- How it is used
- Uses DAO interfaces to isolate persistence behind a boundary while test-driving data-access code.
- How deep it goes
- Explains the interface boundary and a Hibernate save transaction, and discusses implementations using JDBC, Spring JdbcTemplate, and Hibernate.
- Examples
- Uses a PersonDao interface and a Hibernate save operation as concrete examples.
- What you can do after
- Apply it via DAO interfaces to test-drive persistence implementations with unit and integration tests.
Akka in Action, Second Edition
A data access object is an application-layer object that encapsulates operations for accessing a data store.
- How it is used
- Encapsulates database statements behind an abstraction used by controllers for business logic.
- How deep it goes
- Traces failures, concurrency risks, multi-table writes, and slower database-backed testing without showing DAO implementation code.
- Examples
- Uses Conversation and Message insertion, duplicate-record risks, database outages, and database-backed tests.
- What you can do after
- Diagnose database-operation failures and inconsistent multi-step writes when replacing in-memory objects with DAOs.
Read how Akka in Action, Second Edition explains data access object →
Also covered in
- Data-Oriented Programming in JavaIn early access (MEAP)
What to know first
- JDBCJDBC (Java Database Connectivity) is the standard Java API for connecting to databases, executing SQL statements, and processing results.
Related concepts
- repository patternequivalent to · The repository pattern is a software design pattern that abstracts access to and persistence of application or domain data, hiding storage-specific operations.
- test doubleuses · A test double is a substitute for a real dependency or collaborator that provides controlled behavior or enables interaction observation during testing.
- repository annotationconfigured by · @Repository is a Spring stereotype annotation that marks a class as a data-access component eligible for bean registration and persistence-exception translation.
- Spring Data JPAalternative to · Spring Data JPA is a Spring Data module that provides repository abstractions and query support for data access through JPA implementations.
- controllerused by · A controller is a software component that receives input or requests and coordinates other components or operations to produce a response or change application state.
Questions about data access object
What is data access object?
A data access object is a component that encapsulates operations for accessing and manipulating data in a persistent store.
Which Manning books explain data access object?
Java Persistence with Spring Data and Hibernate epub, Test Driven: Practical TDD and Acceptance TDD for Java Developers and Akka in Action, Second Edition.
What should I know before learning data access object?
Manning books that teach data access object usually introduce JDBC first.
What is the difference between data access object and Spring Data JPA?
A data access object is a component that encapsulates operations for accessing and manipulating data in a persistent store. Spring Data JPA is a Spring Data module that provides repository abstractions and query support for data access through JPA implementations.
What is data access object also called?
Data access object is also called DAO.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


