In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Encapsulate data access object
1: through the analysis and summary, all the operations on the database table can be summarized as the addition, deletion, modification and query of the table through JDBC, in order to reduce redundant code
So that it is not necessary to write JDBC programs every time you operate a table, so all data access functions to a table are encapsulated in the data access object.
(Data Access Object) for ease of calling.
2: in order to facilitate data transmission, the scattered field values of all related operations in java programs are often encapsulated into an entity object-entity.
Principles of entity encapsulation:
Table-entity class
Field-attribute
Implement serialization
Provides the set,get method.
The following code is written using the Dao data access object JDBC program, the use of encapsulation to simplify the JDBC development steps.
Just imagine, if there are 10 add requests, 20 delete requests, and write like the JDBC1.0,2.0 version, you have to write 10 times, 20 times a lot of similar code.
Basically consistent code. This is not only time-consuming and labor-consuming, but also does not conform to the three major characteristics of JAVA. Therefore, using the Dao data access layer, the common operations on the table
Encapsulated into a method, so that there are 10 more additions or 20 deletions, we only need to call the encapsulated add or delete method 10 times and 20 times.
Without having to write the method so many times, the development workload is greatly simplified.
The following is the use of Dao ideas to achieve JDBC3.0 is version 3.0, there is a better version to explain! > _ _ <
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.