Java object (PO, BO, VO, DTO, POJO, DAO, Entity, JavaBean, JavaBeans) differentiation, pojojavabeans

Source: Internet
Author: User

Java object (PO, BO, VO, DTO, POJO, DAO, Entity, JavaBean, JavaBeans) differentiation, pojojavabeans

PO: persistent object), Po (persistent object) is the Entity in the Object/Relation Mapping Framework. Each attribute of po basically corresponds to a field in the database table. It is a pure Java object that complies with the Java Bean specifications without adding other attributes and methods. Persistent objects are created by the insert database and deleted by the delete database. Basically, the lifecycle of persistent objects is closely related to databases.

VO: 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, depending on the business needs.

The presentation layer Object (View Object) mainly corresponds to the Data Objects displayed on the presentation interface. a vo Object is used to encapsulate the Object data required for display on the entire interface.

BO: Business Object)Java objects that encapsulate the business logic. The DAO method is called to perform business operations in combination with PO and VO. For details, refer to an online example:

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.

DTO: Data Transmission Object)Is a software application system that transmits data between design patterns. Data transmission targets data access objects to retrieve data from databases. The difference between a data transmission object and a data interaction object or data access object is a data (access and accessors) that does not have any behavior except storage and retrieval ). To put it simply, when we need the content of 10 fields of an object, but this object has 20 fields in total, we do not need to transmit all fields of the entire PO object to the client, instead, it can be re-encapsulated with DTO and passed to the client. At this time, if this object is used to display the corresponding interface, it is called VO.

JavaBean: a reusable componentThat is, "one-time writing, execution anywhere, reuse anywhere ". The class must be specific and public when three conditions are met. ② There is no argument constructor. ③ Public methods that provide consistent design patterns expose Member attributes in the internal domain.

Main purpose: it can be used in functions, processing, values, database access, and JSP for any object that can be created using Java code.

There are two types: one is a an with a User Interface (UI, User Interface); the other is that there is no User Interface, mainly responsible for processing transactions (such as data operations, Database Operations). JSP usually accesses the latter type of JavaBean.

Categories: Session bean, Entity bean, and MessageDrivenBean

-- Session bean Session component is a transient object that runs on the server and executes some application logic processing. It is created by the client application and its data needs to be managed by itself. There are two types: stateless and stateful. -- Entity bean Entity component, which is a persistent object and can be called by other objects. Specify a unique identifier at the time of creation, and allow the client program to locate the beans instance based on the entity bean identifier. Multiple entities can concurrently access the entity bean, and the coordination between transactions is completed by the container. -- MessageDriven Bean Message component is a specification (EIB2.0) specifically used to process JMS (Java Message System) messages ). JMS is a vendor-independent API used to access the message sending and receiving system and provides access methods unrelated to the vendor to access the message sending and receiving service. The JMS client can be used to send messages without waiting for a response.

JavaBeans: JavaBeansIn a narrow sense, it refers to a set of APIs in the java. beans package. In a broad sense, JavaBeans refer to API sets, such as Enterprise JavaBeans.

POJO: POJO (Plain Ordinary Java Object) simple Java ObjectIt is actually a common JavaBeans, which is short for avoiding confusion with EJB. A common java object that does not use Entity Beans can use POJO as a helper class to support business logic.

POJO can be essentially understood as a simple entity class. As the name suggests, POJO classes are used to facilitate programmers to use data tables in databases, POJO classes can be conveniently used as objects, and the get and set methods can also be conveniently called. The POJO class also brings great convenience to the configuration in the struts framework. 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: the data access object is the first object-oriented database interface.Is a Data Access Object ). It can persistently convert POJO into PO and assemble VO and DTO with PO. 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 ).A specific DAO class contains the logic for accessing data from a specific data source. Generally, a DAO class corresponds to a table, and each operation must be associated with a transaction.

 

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.