Several objects in Java (PO, Vo, Dao, Bo, pojo)

Source: Internet
Author: User

I. Po :( persistant object): Persistent Object

It can be viewed as a Java object mapped to a table in the database. Using hibernate to generate Po is a good choice.

Ii. VO :( value object): Value ObjectIt 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, depending on the business needs.


PO can only be used at the data layer, while vo is used at the business logic layer and presentation layer. Each layer operation belongs to its own data object, which can reduce the coupling between layers and facilitate system maintenance and expansion in the future.

Iii. Dao: (data access objects), data access object interface
Dao is a data access object data access interface. Data Access: as its name implies, it deals with databases. Stored in the middle of the business logic and database resources.


J2EE developers use the data access object (DAO) design mode to separate the underlying data access logic from the high-level business logic, so that the DAO mode can focus more on writing data access code.


The DAO mode is one of the standard J2EE design patterns. developers use this mode to separate the underlying data access operations from the upper-layer business logic. A typical DAO implementation has the following components:

1. A Dao factory class;

2. A Dao interface;

3. A specific class implementing the DaO interface;

4. Data Transmission object (sometimes called value object ).

The specific DAO class contains the logic for accessing data from a specific data source.

4. Bo :( Business Object): Business Object layer
Represents all entity classes of "things" in the application field. These entity classes reside on the server and use the service class to help fulfill their responsibilities.

5. pojo :( plain old Java objects), a simple Java object
Actually, it is a common JavaBeans. The pojo name is used to avoid confusion with EJB, And the abbreviation is direct.

Some attributes and Their getter and setter methods can be used as value object or DTO (data transform object. of course, if you have a simple operation attribute, you can do the same, but you cannot have business methods or methods such as connection.

 

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.