Can PVO, DAO, BO, DTO, and POJO be distinguished?

From: https://blog.csdn.net/chl191623691/article/details/78149108

One, PO: (persistant object), persistent object

It can be seen as a java object mapped to a table in the database. It is a good choice to use Hibernate to generate PO.

Two, VO: (value object), value object

It is usually used for data transfer between business layers. Like PO, it only contains data. But it should be an abstracted business object, which can correspond to the table or not, depending on the needs of the business.

PO can only be used in the data layer, VO is used in the business logic layer and presentation layer. The operation of each layer belongs to the data object of the layer itself, so that the coupling between the layers can be reduced, which is convenient for the maintenance and expansion of the system in the future.

Three, 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 dealing with the database. Sandwiched between business logic and database resources.

J2EE developers use the Data Access Object (DAO) design pattern to separate the low-level data access logic from the high-level business logic. Implementing the DAO model can focus more on writing data access code.

The 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;

2. A DAO interface;

3. A concrete class that implements the DAO interface;

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

The specific DAO class contains the logic for accessing data from a specific data source.

Four, BO: (Business Object), business object layer

Represents all entity classes of "things" in the application domain. These entity classes reside on the server and use service classes to assist in their responsibilities.

Five, DTO Data Transfer Object

Mainly used for remote calls and other places where a large number of objects need to be transferred. For example, if we have 100 fields in a table, the corresponding PO has 100 attributes.

But as long as 10 fields are displayed on our interface, the client uses the WEB service to get the data. There is no need to pass the entire PO object to the client. At this time, we can use the DTO with only these 10 attributes to pass the result to the client. This will not expose the server-side table structure.

After arriving at the client, if you use this object to correspond to the interface display, then its identity will be changed to VO at this time.

Six, POJO: (Plain Old Java Objects), simple Java objects

In fact, they are ordinary JavaBeans. The POJO name is used to avoid confusion with EJB, and the abbreviation is more direct. There are some properties and classes with getter and setter methods, which can sometimes be used as value objects or dto (Data Transform Object).

Of course, if you have a simple arithmetic attribute, it is also possible, but business methods are not allowed, and methods such as connection cannot be carried.

Guess you like

Origin blog.csdn.net/u012660464/article/details/113783646