Java's (Po,vo,to,bo,dao,pojo) explanation

Source: Internet
Author: User

The Java (Po,vo,to,bo,dao,POJO) explanation for the O/R Mapping is an abbreviation for Object Relational Mapping ( the Objects relational map). 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 survival of the goal 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. -------------------------------------------------

The

Po is a persisted object that simply represents the physical data entity understanding and coupling of physical entities The data is converted to the programming of the physical data that lives in the business layer , to put it simply, it is the conceptual model transformation that gets . First of all, the Po and VO, they relationship should be independent , a VO can just PO The part of the property). Because of this, the PO is independent, the data persistence layer is independent, it will not be any business interference. Because of this, the business logic layer is also independent, it will not be affected by the data persistence layer is just the business logic processing, as to how to save how to read to others! However, another point, if we do not use the data persistence layer, or do not use Hibernate, then Po and VO can also be the same thing, although this is not good.

----------------------------------------------------Java (Po,vo,to,bo,dao,POJO) explains the PO ( Persistant object) The concept of persistent objects appearing in the O/R mapping, without the O/R mapping, does not exist. Usually the corresponding data model (database), itself also has some business logic processing. 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.

The VO (Value object) Value objects are typically used for data passing between business tiers, and the same is true for the PO as well as just the 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.

to (Transfer object), a data transfer object that is transferred between different tie (relationships) in the application

The BO (business object) service objects see the domain objects in the UML component Domain model from a business model perspective. 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, non - regular Java objects are purely traditional Java objects. That is, in some object/relation mapping tools, the ability to maintain database table records Persisent object is purely a Java Bean Specification - compliant Java object, no additional properties and methods are added. My understanding is the most basic Java Bean, only attribute fields and setter and getter Method!.

The DAO data Access object is a Sun 's standard Java EE design pattern in which an interface is DAO, which is a negative persistence layer operation. Provides interfaces for the business layer. 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 database crud operations ...

O/R Mapper object/relationship map after all The mapping are defined, this O/R Mapper can do a lot of work for us. With these mappings, this O/R mapper can generate all the SQL statements about the object save, Delete, read, and we no longer need to write so many lines of dal code.

Entity Model (Entity mode) DAL (data access Layer) Idal (interface layer) Dalfactory (class factory) BLL (business logic Layer) BOF business Object Framework SOA Servi Ce Orient Architecture Service - oriented design EMF Eclipse Model Framework Eclipse Modeling Framework

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

PO: Full Name is Persistant object The most vivid understanding of persistent objects 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: The full name is business object: The main function of the operational objects is to encapsulate the business logic as an object. This object can include one or more other objects. such as a resume, education experience, work experience, social relations and so on. We can have an education experience corresponding to a PO, work experience corresponding to a PO, social relations corresponding 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-Valued objects viewobject The data Objects that are displayed in the main interface of the presentation layer object. 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 are mainly used for remote calls and other places where large numbers of objects need to be transferred. For example, if we have 100 fields in a table, then the corresponding PO has 100 attributes. However, as long as we display 10 fields on the interface, the client uses the Web service to fetch the data, and there is no need to pass the entire PO object to the client, we can pass the result to the client with a DTO with only these 10 attributes . This also does not expose the service-side table structure. After reaching the client, if the object is used to display the corresponding interface, then its identity will be converted to VO

POJO : Plain Ordinary Java object Simple Java objects personal feeling POJO is the most common and most variable object, is an intermediate object, is also our most often dealing with object.

A POJO persistence is the PO directly with it to pass, the process is the DTO directly used to correspond to the presentation layer is VO

Dao:data Access Object data Access objects This is most familiar to everyone, and the above several o the biggest difference, basically without the possibility and necessity of mutual transformation. Primarily used to encapsulate access to a database. It can be POJO to the PO, with PO assembled VO, DTO

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

The Po:persistant object is persisted to objects that can be viewed as a databaseof theTable-Phase Mappingof theJava object. The simplestof theThe PO is a table in the corresponding databaseof theA record, multiple records can be used with the POof theCollection. The PO should not contain any databaseof theOperation. The Vo:value object value. Typically used between business tiersof theData transfer, like PO, contains only data. But it should be abstracted outof theBusiness objects that can correspond to tables or not, which are based on businessof theRequired. Personal feel with DTO (data transfer object), passed on the web.

Dao:data Access object that 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.

Bo:business object, which encapsulates the Java object of the business logic, invokes the DAO method and combines po,vo for business operations;

POJO:p Lain Ordinary Java object Simple, non-regular Java objects, I personally think it and the other is not a level of things, Vo and Po should belong to it.

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

VO: Value object, view object

PO: Persistent Object

QO: Querying objects

DAO: Data Access Object

DTO: Data Transfer 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 define some methods of querying , which are written in the interface and can have different implementation classes . And this interface can be said to be a DAO. Personally think Qo and DTOs are similar.

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

Po or bo, the closest layer to the database, is an ORM O, basically a database field corresponding to a property in Bo , for synchronization and security considerations, it is best to give DAO or service calls, Instead of using Packcode,backingbean, or Bo tune.

DAO, the data access layer, the object in the Vo,backingbean can be put into ....

DTOs, seldom used, are basically put into DAO, but play a role in transition.

QO, is to put some with persistent query operations with the statement into the.

The basic elements and methods used in the vo,v layer are placed therein. If you want to call Bo, do the Bo conversion vo,vo convert Bo operation. VO 's advantage is that its page element attributes more than Bo, can play a very good role .... -----------------------------------------

It 's not right upstairs, PO is a persistent object. Bo=business object-business object. The PO can be strictly corresponding to the database table, and a single PO is mapped to a table. Bo is the business logic processing object, my understanding is that it is filled with business logic processing, in the business logic of complex applications to be useful.

Vo:value Object Value Objects

View Object Views Objects

PO: Persistent Object

QO: Querying objects

DAO: Data Access Object--also DAO mode

DTO: Data Transfer Object-also DTO mode

Java's (Po,vo,to,bo,dao,pojo) explanation

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.