Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is PO/VO/DAO/BO/DTO/POJO?

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "what is PO/VO/DAO/BO/DTO/POJO". In daily operation, I believe many people have doubts about what PO/VO/DAO/BO/DTO/POJO is. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what is PO/VO/DAO/BO/DTO/POJO?" Next, please follow the editor to study!

1. PO: (persistant object), persistent object

It can be thought of as a java object that maps to a table in the database. Using Hibernate to generate PO is a good choice.

2. VO: (value object), value object

It is usually used for data transfer between business tiers, and just like PO, it only contains data. But it should be an abstract business object, which can correspond to the table or not, according to the needs of the business.

PO can only be used in the data layer, and VO is used in the business logic layer and presentation layer. The operation of each layer belongs to its own data objects, which can reduce the coupling between the layers and facilitate the maintenance and expansion of the system in the future.

3. DAO: (Data Access Objects), data access object interface

DAO is the Data Access Object data access interface, data access: as the name implies, it is to deal with the database. Sandwiched between business logic and database resources.

J2EE developers use the data access object (DAO) design pattern to separate underlying data access logic from high-level business logic. Implementing the DAO pattern allows you to focus more on writing data access code.

DAO pattern is one of the standard J2EE design patterns. Developers use this pattern to separate the underlying data access operations from the upper-level business logic. A typical DAO implementation has the following components:

1. A DAO factory class

two。 A DAO interface

3. A concrete class that implements the DAO interface

4. Data transfer objects (sometimes called value objects).

The concrete DAO class contains the logic to access data from a specific data source.

4. BO: (Business Object), business object layer

All entity classes that represent "things" in the application domain. These entity classes reside on the server and use service classes to assist in their responsibilities.

5. DTO 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. However, as long as 10 fields are displayed on our interface, and the client uses WEB service to obtain data, there is no need to pass the whole PO object to the client. At this time, we can use DTO with only these 10 attributes 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.

6. POJO: (Plain Old Java Objects), a simple Java object

In fact, it is an ordinary JavaBeans, and the name POJO is used to avoid confusion with EJB, and the abbreviation is more direct. Classes with properties and their getter and setter methods can sometimes be used as value object or dto (Data Transform Object). Of course, it's OK if you have a simple operation attribute, but you are not allowed to have business methods or carry methods such as connection.

At this point, the study of "what is PO/VO/DAO/BO/DTO/POJO" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report