In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article is to share with you about Java PO, BO, VO, DTO, POJO, DAO concept and its role and project example diagram is what, the editor thinks it is very practical, so share it with you to learn, hope you can get something after reading this article, say no more, follow the editor to have a look.
PO (named bean, entity, etc.):
Persistant Object persistent objects, the display status of records in database tables in java objects
The best understanding is that a PO is a record in a database.
The advantage is that a record can be treated as an object and can be easily converted to other objects.
BO (named service, manager, business, etc.):
Business Object business object
The main function is to encapsulate the business logic into an object. This object can include one or more other objects.
The image is described as the form and action of an object, of course, there are also some forms and actions related to the base object. Such as dealing with
A person's business logic includes sleeping, eating, working, going to work, and so on. It is possible to have a relationship with others.
In this way, when dealing with business logic, we can deal with BO.
VO (which is also written in from):
Value object value object
Mainly reflected in the object of the view, for a WEB page, the properties of the entire page will be encapsulated into an object. Then a VO object is used to transfer and exchange with the view layer in the control layer.
DTO (processed PO, which may add or decrease the attributes of PO):
Data Transfer Object data transfer object
It is mainly used for remote calls and other places where a large number of objects need to be transferred.
For example, if we have a table with 100 fields, the corresponding PO has 100 attributes.
But only 10 fields are displayed on our interface.
The client uses WEB service to get the data, so there is no need to pass the entire PO object to the client
At this point, we can use only these 10 attributes of DTO to pass the results to the client, so that the server table structure will not be exposed. After arriving at the client, if you use this object to display the interface, then its identity will be changed to VO.
POJO (POJO is a concept or interface whose identity and role change with the environment):
POJO has some parameters of Private as properties of the object. Then get and set methods are defined for each parameter as interfaces for access
Plain Ordinary Java Object simple Java object
That is, POJO is a simple ordinary Java object, it does not contain business logic or persistence logic, but not JavaBean, EntityBean, etc., does not have any special role and does not inherit or implement any other Java framework classes or interfaces.
POJO objects, sometimes called Data objects, are widely used to represent real objects.
When a POJO is persisted, it becomes PO.
Directly use it to transmit and transmit DTO in the process.
Directly used to correspond to the presentation layer is VO
DAO (Data Access Object data access object):
This is the most familiar, and the most different from the above O, there is basically no possibility and necessity to transform each other.
Mainly used to encapsulate access to the database. Through it, POJO can be persisted into PO, and VO and DTO can be assembled with PO.
The Controller control layer is mainly composed of Action/Servlet, etc. (currently, Spring MVC is used through the @ Controller tag)
The middle layer of the business layer dealing with the view layer is responsible for transferring VO objects and calling the business methods of the BO layer, and is responsible for responding to the view layer after the data requested by the view layer is processed.
View (view layer)
Mainly refers to the display layer formed by JSP, HTML and other files.
To sum up, to use a specific X0 depends on the specific environment and project architecture, in different layers, different applications, the identity of the object is also different, and the transformation of the identity of the object is also very natural. Just like you are a husband to your wife and a child to your parents. The original intention of designing these concepts is not to bluff people, but to better understand and deal with all kinds of logic, so that people can better deal with problems in an object-oriented way.
In peacetime development projects, we must over-design each layer, because this will bring a lot of work and repetitive work. If it is not a large system, some layers can be simplified, because the technology serves the application.
Examples of the application of the above terms in practical projects:
Control layer (controller-action), Business layer / Service layer (bo-manager), entity layer (po-entity), dao (dao), View object (Vo- omitted from this project), View layer (view-jsp/html)
These are the concepts and functions of PO, BO, VO, DTO, POJO, DAO and project example diagrams in Java. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.