Chapter 4. Data Access Made Easy
The Data Access Object (DAO) design pattern is a simple and elegant way of abstracting database persistence from application business logic. This design ensures a clear separation of the two core parts of any enterprise application: the data access layer and the service (or business logic) layer. The DAO pattern is a well-understood Java EE programming structure, initially brought to prominence by Sun Microsystems in its Java EE Design Blueprints that has since been adopted by other programming environments such as the .NET framework.
The following image illustrates where the DAO layer sits in the overall application structure:
Changing an implementation in the DAO layer should not affect the service layer in any way. This is achieved by defining DAO interfaces to encapsulate the persistence operations that the service layer can access. The DAO implementation itself is hidden to the service layer.