Several objects of Java (Po,vo,dao,bo,pojo) 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.
Third, Dao:data Access object, which 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.
Four, Bo:business object Business objects, encapsulates the business logic of the Java object, by invoking the DAO method, combined with PO,VO for business operations.
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.

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.

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

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.