JavaBean, Entitybean, POJO, PO, Bo,vo,dto,dao difference __java

Source: Internet
Author: User
Tags one table

First, remember. This class is a common class (public) and must have a common default constructor. The properties of this class are accessed using getter and setter, and other methods conform to the standard naming conventions. (JavaBean is a class that defines a series of get<name> and Set<name> methods and exposes member variables through the Get Set method)

JavaBean: A reusable component written in the Java language, whose method naming, structuring, and behavior must conform to specific conventions.


POJO (Plain ordinary Java Object): It does not contain business logic or persistent logic, but not JavaBean, Entitybean, and so on, without any special roles and classes or interfaces that do not inherit or implement any other Java framework.


Po:pojo in the persistence layer of the embodiment of Pojo after the persistence of the PO. The concept of the O/R mapping occurs when there is no O/R mapping, and no such concept exists. 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 a database. The simplest PO is a record in a table in the corresponding database, and multiple records can be set with a PO. The PO should not contain any operations on the database.

Dao:po persisted to the database for related database operations (Cruq), the methods for database operations are uniformly placed in a Java object, which is DAO.

Bo:pojo at the business level, for business operations, more of the packaging of objects from the business, such as a user Bo, may include name, age, sex, privilege, group, etc., these attributes in the database may be in more than one table, Since each table corresponds to a PO, our BO needs these PO combinations (or regroup) to become a complete object on the business.

VO (Value object/view Object): The embodiment of Pojo in the presentation layer. When we're done with the data, when we need to show it, the Pojo that passes to the presentation layer becomes VO. It is used to show the data.

DTO (Data Transfer Object): Pojo when passed between systems. When we need to pass data between two systems, one way is to serialize the Pojo and pass it, and the pojo of the passing state is the DTO.

EJB (Enterprise JavaBean): I think it's a set of "feature" JavaBean. It says JavaBean is a Java object that implements a specification. EJB is said to be a set of JavaBean, meaning that this group of JavaBean together implements the business logic of an enterprise group. A set of JavaBean here is not a random combination, they want to meet a business function to achieve a match. For example, for a dress, it includes a hat, a dress, a pair of trousers and two shoes. This dress is the EJB, the other is a javabean.

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.