Use JDBC to connect to the MySQL database-Typical Case Analysis (9)-financial account DAO design and implementation, jdbcmysql
Reprinted Please note:Http://blog.csdn.net/uniquewonderq
Problem: 1. Add a financial account: 2. Modify the information of a financial account. 3. modify the status of a financial account. 4. query all financial accounts. 5. query all the information of a financial account based on the ID of a financial account.
Solution: During Enterprise Development, the hierarchical mode is usually used.
Presentation Layer + control layer + business layer + Persistence Layer + Data Source. The persistence layer is used to map the database content to objects through some technical framework, and perform database operations by operating these objects. The main purpose is to facilitate operations on the database by the differences between minutes Business Objects and the Relational Tables of the data source. The persistence layer can be implemented using technologies such as JDBC, Hibernate, and Mybatis. In this case, the DAO mode is used to implement the persistent layer through JDBC. The DAO mode is Data Access Object, that is, the Data Access Object. It exists between the data source and the business layer and encapsulates access details to the data, such as database connection, sending and executing SQL statements, and closing connection resources. DAO aims to completely separate underlying data access operations from high-level business logic operations, provide transparent data access services for the business layer, and enhance program flexibility. The DAO component encapsulates operations on data tables to provide data access services for business components. In business components, some simple business processing can be completed only by using a DAO component. However, some business processing is complicated, you need to use the nogogo DAO component. To ensure business integrity and reusability of DAO components, transaction control cannot be written in every method of DAO components. Instead, transaction control should be independently encapsulated and then applied in business methods.
Subsequent content, which will be updated in the future .....