Mvc+ado mode

Source: Internet
Author: User

Mvc+dao design mode Blog Category:
    • Java
    • Java Web Development
Mvc+dao design mode

This digest from: http://www.paper.edu.cn application of Struts framework based on Mvc+dao design pattern Boo Jacin


At the model level, if the data source changes, it inevitably leads to different data access, and JavaBean is inevitably modified to look for new data sources. When the business logic is executed, the implementation of the real theme is not the same, but there must be the same or repeated steps and procedures before and after implementing the real topic, resulting in code duplication. In the servlet, if the real topic implementation class is called directly, it will inevitably bring strong coupling and is not easy to maintain.
In view of the above problems, a DAO pattern (Data Access object) based on the MVC pattern model layer is generated, mainly by the factory class (Factory), the proxy class (proxies), the implementation class (DAOIMPL), the DAO interface, and the Value object Class (VO). and database connection classes.



(1) Factory class: Used to instantiate the object being manipulated.

(2) proxy class: Instead of the real theme implementation class to do all the work, so that the real theme implementation class can concentrate on the real topic, and the preparation and finishing work is done by the proxy class.
(3) Daolmpl class: Complete the business logic processing of the real topic of data access, and get the data information that the end user wants to obtain.
(4) DAO Interface: Defines the specific action method that is required.
(5) Vo class: Encapsulates a database table, 1 VO classes represent a table, and 1 Vo class objects represent 1 records in a table. The properties of the object and corresponding setter methods and getter methods are used to set or get the fields in the database table.

(6) DbConnection class: Dedicated to connect the database, can modify the properties of the class according to different data sources and persistent data storage, reduce the work of the theme implementation class. Mvc+dao mode, further subdivide the business logic processing function, although the amount of early development code has increased, but in the medium and large-sized projects, the advantages are very clear, the business objects and data to achieve a thorough separation, portability and maintainability greatly enhanced, simplifying the business module, improve the overall system readability and development efficiency. Of course, this design pattern still has flaws in the nesting and coupling of DAO objects and SQL statements.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.