Enterprise Java Development@TOPIC@

Chapter 32. Data Access Object (DAO) Pattern

32.1. Context
32.2. Problem
32.3. Forces
32.4. Solution
32.5. DAO Implementation Structure
32.6. Consequences

Use a Data Access Object (DAO) to abstract and encapsulate access to business objects in the data source


Business Logic
  • Object within the business domain that needs access to data (e.g., session bean)

  • Knows when/why data is needed, but not where or how to access it

Data Access Object
  • Abstracts the access details from the business object

  • Knows where/how data is accessed, but not when or why to access it

Business Object (Entity)
  • An entity within the business logic

  • Encapsulates information and data business rules within application

  • A data carrier of information to/from the DAO

Data Source
  • Physically stores the data (e.g., database)





Key point: hide details from business logic and other interfacing components