The data access object pattern
The data access object (DAO) pattern is a very popular design pattern for the persistent layer in a J2EE application. It separates the business logic layer and persistence layer. The DAO pattern is based on the encapsulation and abstraction object-oriented principles. The context for using the DAO pattern is to access and persist data depending on the underlying vendor implementation and type of storage, such as object-oriented database, flat files, relational databases, and so on. Using the DAO pattern, you can create a DAO interface, and implement this DAO interface to abstract and encapsulate all access to the data source. This DAO implementation manages the database's resources like connections with the data source.
The DAO interfaces are very generic to all the underlying data source mechanisms, and don't need to change for any changes in the low-level persistence technologies. This pattern allows you to adopt any different data access technologies without...