DAO basic learning notes and dao basic learning notes
I,DAO
1. concept:
(1) Date Access Object (Data Access Object)
(2) between business logic and persistent data
(3) access to persistent data
(4) Class ---> DAO ---> data table
2. Mode:
(1) Isolate business logic code and data access code
Business logic layer <====> data access layer
(2) isolate different databases
Business logic layer ====> data access layer -----> Oracle
-----> SQLServer
-----> MySQL
3. Components of DAO mode
DAO implementation class ------> DAO Interface
------> Entity
------> Database tools
4. Steps for using DAO
(1) Create a database table
(2) create an object class (attributes in the class should correspond to tables in the database)
(3) create a base class (Interface Class) for DAO)
(4) Create the DAO implementation class
(5) create a DAO class for a specific table
(6) Create the DAO class implementation class for a specific table
(7) create an interface class for the business logic layer
(8) Create an implementation class for the interface class at the business logic layer
(9) create a test class
II,Hierarchical Development
1. Features of layering
(1) Each layer has its own responsibilities
(2) The previous layer does not need to care about the implementation details of the next layer. The previous layer uses its functions through external interfaces provided by the next layer.
(3) The previous layer calls the functions of the next layer. The next layer cannot call the functions of the previous layer.
2. Advantages of hierarchical development:
(1) Each layer focuses on the implementation of its own functions to improve the quality.
(2) easier division of labor and collaboration, and improved development efficiency
(3) Easy to reuse code
(4) Easy program Expansion
3. sequential access principle:
(1)The next layer serves the previous layer, but does not use the upper layer services.(For example, foundations and buildings)
(2) In a layered structure, data is transmitted between different layers through the entity class
Business Logic<----------Entity class-------->Data access layer
III,Knowledge Extension
1. Form of receiving parameters:Password ='"+ Password +"';(A representation parameter is followed by double quotation marks in single quotes, and a plus sign is added before and after parameters in double quotes)
2. The properties table must be created under the src File
3. "localhost" in the URL in the properties table indicates the IP address of the local machine. You can directly enter the field "127.0.0.1" or simply enter "//".
The IP address of the local machine can be expressed in three forms:
url=jdbc:mysql://localhost:3306/day
url=jdbc:mysql://127.0.0.1:3306/day
url=jdbc:mysql:///day
4. When using Eclipse for development, there may be different development tools or computer versions when importing others' projects, which may cause a project warning. The steps to deal with them are as follows:
(1) Handling exclamation points
Select project ----- right-click ----- Properties ---- java build path ----- libraries ----- find and select the resource package with the red error mark, and then remove it ----- then add library ----- apply OK after default Selection
(2) handle Red errors
Select project ----- right-click ----- Properties ---- java compiler ----- first remove the check box before enable project specific settings ----- then select and enter configure workspace settings on the right of the same industry... ----- default application apply OK