Several objects of Java (po,vo,dao,bo,pojo,dto) explained

Source: Internet
Author: User

One, Po:persistant object persistent objects, can be seen as a Java object mapped to a table in the database. The simplest PO is a record in a table in the corresponding database, and multiple records can be used with a collection of PO. The PO should not contain any operations on the database.
Two, Vo:value object value objects. Typically used for data transfer between business tiers, as is the case with PO, which contains only data. But it should be abstracted out of the business object that can correspond to the table, or not, depending on the needs of the business. Personally feel the same DTO (data transfer object) that is passed on the web.

Dao:data Access object is a standard Java EE design pattern for sun. This object is used to access the database. Usually used in conjunction with PO, DAO contains various methods of operation of the database. Through its method, combine the PO to carry on the related operation to the database. Sandwiched between business logic and database resources. With Vo,
Provide CRUD operations for the database ...

Iv. BO (Business object)
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. This object can include one or more other objects.
such as a resume, educational experience, work experience, relationships and so on.
We can have an education experience corresponding to a PO, the work experience corresponds to a PO, the relationship corresponds to a PO.
Create a CV-based Bo object to process resumes, each BO containing these po.
When we handle business logic like this, we can deal with Bo.

(There are three main concepts about BO:
1. Contains only the properties of the business object;
2, only include business methods;
3, both are included.
In practice, it is not important to think which concept is correct, and the key is to fit the needs of the project in practical application.

V, Pojo:plain ordinary Java object Simple and irregular Java objects, I personally think it and the other is not a level of things, Vo and Po should belong to it.

VI. Dto:data Transfer Object (data Transfer object) a DTO is a set of simple containers for aggregated data that needs to be transported across processes or network boundaries. It should not contain business logic and limit its behavior to activities such as internal consistency checks and basic validation. Note that the DTO does not rely on any new classes for implementing these methods. When designing data transfer objects, you have two main choices: Use a generic collection, or create a custom object using explicit getter and setter methods. (Information: http://baike.baidu.com/view/160599.htm)


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 world of O/R mapping, there are two basic and important things to understand, namely Vo,po.
VO, a Value object, a PO, a persistent object (Persisent objects) that consists of a set of properties and properties of the get and set methods. Structurally, they are nothing different. But it is completely different from its meaning and nature.


1. Vo is created with the New keyword and collected by the GC.
The PO is created when new data is added to the database, and the data in the database is deleted. And it can only survive in a database connection, and the disconnection is destroyed.
2. Vo is a value object, the precise point is that it is a business object, is living in the business layer, is used by business logic, it is the purpose of survival is to provide a place for the data to survive.
The PO is stateful, and each property represents its current state. It is the object representation of the physical data. Using it, we can decouple our programs from physical data and simplify the transformation between the object data and the physical data.
3. Vo's properties are different depending on the current business, that is, each of its properties corresponds to the name of the data needed for the current business logic.
The properties of the PO correspond to the field one by one of the database table. The PO object needs to implement the serialization interface.

PO:
Persistant Object Persistent Objects
The most vivid understanding is that a PO is a record in the database.
The advantage is that a record can be processed as an object and can be easily converted to other objects.


BO:
Business Object
The main role is to encapsulate the business logic as an object. This object can include one or more other objects.
such as a resume, educational experience, work experience, relationships and so on.
We can have an education experience corresponding to a PO, the work experience corresponds to a PO, the relationship corresponds to a PO.
Create a CV-based Bo object to process resumes, each BO containing these po.
When we handle business logic like this, we can deal with Bo.


VO:
Value Object Value objects
ViewObject Presentation Layer Objects
The data object that the main interface displays. For a Web page, or an interface for SWT and swing, use a Vo object to correspond to the value of the entire interface.

Dto:
Data Transfer Object Data transfer objects
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, and this will not expose the service-side table structure. After the client is reached, if the interface is displayed with this object, then its identity will be converted to VO.


Pojo:
Plain ordinary Java object simple Java objects
Personal feeling Pojo is the most common and changeable object, is an intermediate object, is also our most often dealing with objects.
A Pojo is a PO after persistence
It is the DTO that passes and passes directly through it.
Directly used to correspond to the presentation layer is VO

Several objects of Java (po,vo,dao,bo,pojo,dto) explained

Related Article

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.