Dao/dto/po/vo/bo/qo/pojo in Java

Source: Internet
Author: User

ORM: is an abbreviation for the Object relational Mapping (objects 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/m world, there are two basic and important things to understand, namely VO, PO.

PO: (Persistant object), persistent objects

Can be seen as a Java object mapped to a table in the database. Using hibernate to generate a PO is a good choice. They are made up of a set of properties and properties of the get and set methods.

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.

VO: (Value object),

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 business objects that can correspond to tables, or not, depending on the needs of the business.

PO can only be used in the data layer, VO used in the business logic layer and presentation layer. Each layer operation belongs to the layer's own data object, which can reduce the coupling between the layers, so as to facilitate the maintenance and expansion of the system later.

VO differs from PO:

    • 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.
    • 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, you can decouple the program from physical data and simplify the conversion between the object data and the physical data.
    • 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.

DAO: (Data access Objects), Access object interface

DAO is the data Access object that is accessed by data access: As the name implies, dealing with the database. Sandwiched between business logic and database resources.

Java EE developers use data Access object (DAO) Design patterns to separate the underlying data access logic from the high-level business logic. Implementing a DAO pattern can be more focused on writing data access code.

DAO mode is one of the standard Java EE design patterns. Developers use this pattern to separate the underlying data access operations from the upper-level business logic. A typical DAO implementation has the following components:

    • A DAO factory class.
    • A DAO interface.
    • A concrete class that implements the DAO interface.
    • Data passing objects (sometimes called value objects).

The specific DAO class contains the logic to access data from a specific data source.

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, provides a crud operation of the database.

BO: (business object), operational objects Layer

All entity classes that represent "things" in the application realm. These entity classes reside on the server and take advantage of the service classes to assist in fulfilling their responsibilities.

The Java object that encapsulates the business logic, by invoking the DAO method, in conjunction with Po, VO for business operations.

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, education experience, work experience, social relations and so on. Can be the 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 you handle business logic like this, you can deal with Bo.

POJO (POJOs): (Plain old Java Objects), simple Java Object

The actual is ordinary JavaBeans, uses the Pojo name is to avoid and the EJB to confuse, and the abbreviation compares directly.

Some of these properties and their getter, setter method classes, can sometimes be used as value Object or a DTO (Data Transform object). Of course, it is possible to have a simple arithmetic attribute, but it is not allowed to have business methods or to carry methods such as connection.

To: (Transfer object), data transfer object

An object that is transferred between different relationships in the application.

QO: (Query object), querying objects

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 a table has 100 fields, the corresponding PO has 100 attributes. However, as long as 10 fields are displayed on the interface, and the client uses the Web service to fetch the data, there is no need to pass the entire PO object to the client, so the result can be passed to the client with a DTO with only these 10 attributes, thus not exposing 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.

Other:

Model: Typically a JavaBean object, such as a table associated with a database.

Service: For external calls, it is equal to Dao,model, etc. are packaged.

Impl: Defines the interface implementation.

Util: Typically tool classes, such as string processing, date processing, and so on.

DAL: Data access layer.

Idal: Data access interface layer.

Dalfactory: Data access Layer factory.

BLL: Business logic layer.

Bof:business object Framework, business object framework

Soa:service Orient Architecture, service-oriented design

Emf:eclipse Model Framework,eclipse Modeling Framework

Reference:

Http://www.cnblogs.com/bluestorm/archive/2012/09/26/2703234.html

Http://www.cnblogs.com/dzcWeb/p/7060734.html

Dao/dto/po/vo/bo/qo/pojo in Java

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.