I. Overview
In the actual programming development, only one database object mapping can not satisfy all kinds of complex requirements.
The O/R Mapping is an abbreviation for the Object Relational Mapping. The popular point is that the object is bound to the relational database, and the object is used to represent the relational data. In the O/R mapping World, there is a basic and important thing to understand, namely PO.
Second, contrast
The following is a general definition of common sense, usually with this suffix "po does not add"
Of course, you can also define your own various O objects, easy to develop and understand, such as the personal commonly used to receive the front-end parameters of the RO "Request object", QO "Query Object" and so on
| Name |
Name |
Basic meaning |
Note |
| PO |
Persistant Object
Persistent objects |
They are made up of a set of properties and properties of the get and set methods
Can be viewed as a Java object mapped to a table in the database
The properties of the PO are corresponding to the field one by one of the database table. |
It is not recommended to add any logic
May be the base class or attribute of all other O |
| VO "1" |
Value Object
Value Object |
Business objects, which exist at the business level, are used by business logic,
The purpose of its survival is to provide a place for the data to survive. |
|
| VO "2" |
View Object
Presentation Layer Object |
The data object that the main interface displays. For a Web page,
Or an interface of SWT and swing, with a Vo object corresponding to the value of the entire interface. |
|
| BO |
Business Object
Business Objects |
From the business model perspective, see the domain objects in the UML component Domain model.
A Java object that encapsulates the business logic, by invoking the DAO method and combining Po,vo for business operations. |
|
| Pojo |
Plain ordinary Java Object
Simple, rule-free Java object |
Pojo is the most common and changeable object and is an intermediate object |
|
| Dto |
Data Transfer Object
Data Transfer Object |
It is mainly used for remote calls, etc. where large quantities of objects need to be transferred.
For example, if we have 100 fields in a table, then the corresponding PO has 100 attributes.
But we just show 10 fields on the interface,
The client uses the Web service to get the data, and there is no need to pass the entire PO object to the client.
At this point we can pass the result to the client with a DTO with only these 10 attributes, so that the service-side table structure is not exposed.
After reaching the client, if the object is used to display the corresponding interface, then its identity will be converted to VO |
|
| DAO |
Data Access Object
Data Access Objects |
And above is not a concept at all
Primarily used to encapsulate access to a database. It can be pojo to the PO, with PO assembled VO, DTO |
|
java-Basics-Objects in actual programming of "four"