I. Development structure of information systems
Client layer-------Display layer-------Business layer---------data layer---------Database
1. Customer Layer: The client layer is the clients, the simple is the browser.
2. Display layer: Jsp/servlet for display to the browser.
3. Business layer: Consolidates the atomic operations of the data layer .
4. Data layer: Atomic operations for databases, additions, deletions, etc.;
Second, DAO (Data Access Object) Introduction
DAO is applied to the data layer, which is used to access the database and manipulate the database class.
Third, the structure of DAO design pattern
DAO design patterns generally fall into several categories:
1.VO (Value Object): A class that holds a row of data for a Web page that is a record, such as a Web page to display a user's information, the class is the user's class.
2.DatabaseConnection: Used to open and close the database.
3.DAO interface: Used to declare operations for a database.
4.DAOImpl: DAO interface must be implemented, real implementation of the DAO interface functions, but does not include the opening and closing of the database.
5.DAOProxy: The DAO interface is implemented, but only with Daoimpl, but includes the opening and closing of the database.
6.DAOFactory: Factory class, containing getinstance () create a proxy class.
Iv. Benefits of DAO
The advantage of DAO is that the interface provided to the user is only a DAO interface, so if the user wants to add data, only the CREATE function needs to be called, and the operation of the database is not required.
Five, DAO package naming
For DAO, the naming of packages and the naming of classes must be hierarchical.
The core idea of DAO Pattern:
1. All database accesses are done through the DAO component, and the DAO component encapsulates the atomic operations such as CRUD.
2, the business logic component relies on the database atomic operation provided by DAO component, and accomplishes the system business logic.
Java DAO Design Pattern