The distinction between various Java objects (Po,bo,vo,dto,pojo,dao,entity,javabean,javabeans)

Source: Internet
Author: User

PO: Persistent Objects (persistent object), PO (Persistent object) is the entity in the object/relation mapping frame, Each property of a PO basically corresponds to a field within a database table. A pure Java object that conforms to the Java Bean Specification and does not add other properties and methods. Persistent objects are created by the Insert database and deleted by the database delete. Basically, the persistent object life cycle is closely related to the database.

VO: A Value object, typically used for data passing between business tiers, is just like a PO and 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.

The presentation Layer object (View object), which mainly corresponds to the data object displayed by the display interface, uses a Vo object to encapsulate the entire interface to display the desired object data.

BO: An abbreviation for the business object layer, which encapsulates the Java object of the business logic, by invoking the DAO method and combining Po,vo for business operations. You can see an example on the Internet:

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.

DTO: Data Transfer object, which is a software application system for transferring data between design patterns. The goal of data transfer is often to retrieve data from the database. The difference between a data transfer object and an object or data Access object is a data (access and accessor) that does not have any behavior other than storing and retrieving it. Simply put, when we need an object 10 fields of content, but this object has a total of 20 fields, we do not need to transfer the entire PO object all fields to the client, but can be re-encapsulated with DTOs, passed to the client. At this point, if the object is used to display the corresponding interface, it is called VO.

JavaBean: A reusable component , which is "write once, execute anywhere, reuse anywhere." Satisfies three conditions the ① class must be concrete and public ② with a parameterless constructor ③ provides a common method of conforming design patterns that exposes the internal domain member properties.

Main purpose: Can be used in functions, processing, values, database access and jsp any object that can be created in Java code.

There are two kinds: one is the JavaBean of the user interface (Ui,user Interface), and the other is that there is no user interface, which is mainly responsible for processing the javabean of transactions (such as data operations, manipulating databases). The JSP typically accesses the latter type of JavaBean.

Categories: usually have session bean,entity Bean,messagedrivenbean three categories

The --session Bean Session widget, which is a short-lived object that runs on the server and performs some application logic processing, is established by the client application and its data needs to be managed by itself. It is divided into stateless and stateful two kinds. The --entity Bean entity widget, which is a persistent object that can be called by other objects. Specifies a uniquely labeled identity when established, and allows the client to locate the beans instance based on the entity Bean identity. Multiple entities can access entity beans concurrently, and coordination between transactions is done by the container. The --messagedriven Bean Message widget is a specification (EIB2.0) that is designed to handle JMS (Java message System) messages. JMS is a vendor-agnostic API that accesses messaging services by accessing messaging systems and providing vendor-agnostic access methods. JMS clients can be used to send messages without waiting for a response.

Javabeans:javabeans In the narrow sense, it refers to the JavaBeans specification, which is a set of APIs located in the Java.beans package. Broadly speaking, JavaBeans refers to a collection of APIs, such as Enterprise JavaBeans.

Pojo:pojo (Plain ordinary Java object) Simple Java objects , actually is the ordinary JavaBeans, is to avoid and EJB confusion created by the abbreviation. By means of generic Java objects that do not use entity beans, Pojo can be used as an aid class to support business logic.

Pojo can be understood as a simple entity class, as the name implies that the role of Pojo class is convenient for programmers to use data tables in the database, for the vast number of programmers, it is convenient to use the Pojo class as an object, of course, it is also convenient to call its Get,set method. The Pojo class also brings a lot of convenience to our configuration in the Struts framework. a Pojo is a PO after persistence It is the DTO that passes and passes directly through it.
Directly used to correspond to the presentation layer is VO
DAO: A data Access object is the first object-oriented database interface, is a data access Object. It can be pojo persistent into Po, with PO assembled out VO, DTO. DAO mode is one of the standard Java EE design patterns. Developers use this pattern to separate the underlying data access operations from the business logic on top. A typical DAO implementation has the following components: 1. A DAO factory class; 2. A DAO interface; 3. A specific class that implements the DAO interface; 4. Data passing objects (sometimes called value objects).The specific DAO class contains the logic to access data from a particular data source, typically a DAO class and a table, with each operation associated with the transaction.

The distinction between various Java objects (Po,bo,vo,dto,pojo,dao,entity,javabean,javabeans)

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.