Understanding of VO and po-Explanation of Java (PO, Vo, to, Bo, Dao, pojo)

Source: Internet
Author: User
O/R Mapping is the abbreviation of Object Relational ing. In layman's terms, it is to bind an object to a relational database and use an object to represent relational data. In the O/R Mapping world, there are two basic and important things to understand: Vo and Po.
Vo, value object, Po, and persisent object are composed of get and set methods of a group of attributes and attributes. In terms of structure, they are nothing different. But in essence, it is completely different.

1. Vo is created with the New Keyword and collected by GC.
Po is created when new data is added to the database, and deleted when data in the database is deleted. In addition, it can only survive in one database connection and will be destroyed if the connection is closed.

2. Vo is a value object. Specifically, Vo is a business object that is used by the business logic and survive at the business layer. It aims to provide a place for data to survive.
Po is stateful, and each attribute represents its current state. It is the object representation of physical data. Using it can decouple our programs from physical data and simplify the conversion between object data and physical data.

3. The VO attributes vary according to the current business. That is to say, each of its attributes corresponds to the names of the data required by the current business logic.
Po attributes correspond to the fields in the database table one by one.

The PO object must implement the serialization interface.

-------------------------------------------------

Po is a persistent object. It only represents an object of a physical data entity. Why does it need it? It simplifies our understanding and coupling of physical entities, and simplifies the programming of converting object data to physical data. What is VO? It is a value object. To be precise, it is a business object that lives on the business layer. It is something that needs to be understood and used by the business logic, it is obtained by converting the conceptual model.
First, let's talk about po and VO. Their relationship should be independent of each other. a vo can be only a part of po or composed of multiple Po, it can also be equivalent to a PO (of course I mean their attributes ). As a result, the PO is independent, and the data persistence layer is independent, so it is not subject to any business interference. In this case, the business logic layer is also independent and will not be affected by the data persistence layer. The business layer only cares about the processing of the business logic. As for how to read and give it to others! However, if we do not use the data persistence layer or hibernate, Po and VO can be the same thing, although this is not good.

-------------------------------------------------- Explanation of Java (PO, Vo, to, Bo, Dao, pojo)

Po (persistant object) Persistent Object
The concept that appears during o/R ing. If there is no o/R ing, this concept does not exist. Usually it corresponds to the data model (database), and some business logic is processed. It can be viewed as a Java object mapped to a table in the database. The simplest Po is to correspond to a record in a table in the database. A set of PO can be used for multiple records. The PO should not contain any operations on the database.

VO (Value Object) Value Object
It is usually used for data transmission between business layers. Like Po, it only contains data. However, it should be an abstract business object, which can correspond to a table or not. This is based on the business needs. I personally think it is the same as DTO (data transmission object) and transmitted on the web.

To (transfer object), a data transmission object
Objects transmitted between different tie (LINKS) of an application

Bo (Business Object) Business Object
From the business model perspective, see the domain objects in the UML component domain model. Java objects that encapsulate the business logic, and perform business operations by calling the DAO method and combining Po and VO.

Pojo (plain ordinary Java object) Simple and rule-free Java object
Pure traditional Java objects. In other words, in some object/relation mapping tools, the persisent object that can maintain database table records is a pure Java object that complies with Java Bean specifications, without adding other attributes and methods. My understanding is the most basic Java Bean, only the attribute fields and the setter and getter methods !.

Dao (Data Access Object) Data Access Object
Is a standard J2EE design mode of sun. There is an interface in this mode that is Dao, and its operation on the negative persistence layer. Provides interfaces for the business layer. This object is used to access the database. It is usually used in combination with Po. Dao contains various database operation methods. It combines Po with other methods to perform database operations. Stored in the middle of the business logic and database resources. Works with Vo to provide database crud operations...

O/R mapper object/relationship ing
After all mapping is defined, this o/R mapper can help us do a lot of work. Through these mappings, this o/R mapper can generate all SQL statements about saving, deleting, and reading objects. We no longer need to write so many lines of Dal code.

Entity model)
Dal (data access layer)
Idal (interface layer)
Dalfactory)
Bll (business logic layer)
Bof Business Object framework
SOA service Orient Architecture Service-Oriented Design
EMF eclipse model framework eclipse modeling framework

----------------------------------------

Po: full name is
Persistant Object Persistent Object
A po is a record in the database.
The advantage is that a record can be processed as an object, which can be easily converted to other objects.

Bo: Full name:
Business Object: Business Object
The main function is to encapsulate the business logic as an object. This object can include one or more other objects.
For example, a resume includes educational experience, work experience, social relationship, and so on.
We can correspond an educational experience to a po, a work experience to a po, and a social relationship to a po.
Create a bo object to process the resume. Each Bo contains the Po.
In this way, we can process the business logic for Bo.

VO:
Value object Value Object
Viewobject presentation layer object
It mainly corresponds to the Data Objects displayed on the interface. For a Web page, or a SWT or swing interface, use a Vo object to correspond to the value of the entire interface.

Dto:
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 a table has 100 fields, the corresponding Po has 100 attributes.
However, we only need to display 10 fields on the interface,
The client uses Web service to obtain data. It is not necessary to pass the entire Po object to the client,
In this case, 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 the client is reached, if this object is used for display on the corresponding interface, then its identity will be changed to VO

Pojo:
Plain ordinary Java object simple Java object
I personally think that pojo is the most common and variable object. It is an intermediate object and the most common object to deal.

After a pojo is persisted, it is the Po
It is DTO in the process of passing and passing.
Directly used to correspond to the presentation layer is Vo

Dao:
Data Access Object
This person is the most familiar with it. It is the most different from the previous O, and there is basically no possibility or need to convert each other.
It is mainly used to encapsulate access to the database. With pojo, pojo can be persistently converted into Po, and PO can be assembled into vo and DTO.

-----------------------------------------------------------------

Po: persistant Object Persistent object, which can be considered as a Java object mapped to a table in the database. The simplest Po is to correspond to a record in a table in the database. A set of PO can be used for multiple records. The PO should not contain any database operations.


VO: Value Object value object. It is usually used for data transmission between business layers. Like Po, it only contains data. However, it should be an abstract business object, which can correspond to a table or not. This is based on the business needs. I personally think it is the same as DTO (data transmission object) and transmitted on the web.

Dao: Data Access Object: the data access object used to access the database. It is usually used in combination with Po. Dao contains various database operation methods. It combines Po with other methods to perform database operations.

Bo: Business Object business object. It encapsulates Java objects of business logic. It calls DAO method and uses Po and VO to perform business operations;

Pojo: plain ordinary Java object is a simple and non-Rule Java object. I personally think it and others are not at the same level. Vo and PO should both belong to it.

---------------------------------------------
VO: Value Object and view object
Po: Persistent Object
Qo: query object
Dao: Data Access Object
Dto: Data Transmission object
----------------------------------------
The actionform in struts is a Vo;
The Entity Bean in Hibernate is a po, also called pojo;
The criteria in Hibernate is equivalent to a Qo;
When using hibernate, we will define some query methods. These methods can be written in interfaces and have different implementation classes. This interface can be called Dao.
I personally think that Qo is similar to DTO.
----------------------------------------
Po is also called Bo. The closest layer to the database is the o in the orm. It is basically an attribute corresponding to the database field in the Bo. For the sake of synchronization and security, it is best to only call Dao or service, instead of using packcode, backingbean, Or Bo.
Dao, data access layer, put objects in vo and backingbean ....
DTO is rarely used. It is basically put into Dao, but serves as a transitional function.
Qo puts some query operations and statements with durability ..
Basic elements and methods used in vo and V layers are included. If you want to call Bo, you need to convert Bo to Vo and VO to Bo. The advantage of VO is that its page has more element attributes than Bo, which can play a very good role ....
-----------------------------------------
Wrong upstairs, Po is a persistent object. BO = Business Object-business object.
A po can correspond to a database table strictly, and a table is mapped to a po.
Bo is the object of business logic processing. My understanding is that it is full of business logic processing and is useful in complicated business logic applications.
VO: value object Value Object and view object
Po: Persistent Object
Qo: query object
Dao: Data Access Object-there is also the DAO mode
Dto: Data Transmission object-also has the DTO Mode

 

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.