Java--VO, DTO, DO, PO, Entity, JavaBean brief description

Brief description of VO, DTO, DO, PO, Entity, JavaBean

concept:

VO (View Object): View object, used for the presentation layer, its role is to encapsulate all the data of a specified page (or component).

DTO (Data Transfer Object): Data transfer object. This concept is derived from the J2EE design pattern. The original purpose was to provide coarse-grained data entities for EJB distributed applications to reduce the number of distributed calls, thereby improving distributed calls Performance and reduce network load, but here, I generally refer to the data transmission object between the presentation layer and the service layer.

DO (Domain Object): Domain objects are tangible or intangible business entities abstracted from the real world.

PO (Persistent Object): Persistent object, which forms a one-to-one mapping relationship with the data structure of the persistence layer (usually a relational database). Or several) corresponds to one (or several) attributes of PO.

Entity: Entity bean, generally used for ORM object-relational mapping, an entity is mapped into a table, generally no business logic code.

JavaBean: JavaBean is a reusable component written in Java language. To be written as a JavaBean, the class must be concrete and public, and have a parameterless constructor. JavaBean exposes internal domain member properties by providing public methods that conform to a consistent design pattern. More is a specification, that is, a java object that contains a set and get methods. javaBean can make the application more object-oriented, can encapsulate the data, and separate the business logic and display logic of the application, reducing the development complexity and maintenance cost.

Each field in the Entity corresponds to the database, and each field in the
dto corresponds to your front page,
VO, which is used to convert from entity to dto, or from dto to entity in the middle.
For example:
your html page has three fields, name, pass, and age in
your database table, there are two fields, name, pass (note that there is no age) and your dto should have the following three (Because it corresponds to three fields on the html page)

private String name;
private String pass; 
private String age;
1
2
3 At
this time, you should have two in your entity (because it corresponds to 2 fields in the database table)

String name Private;
Private String Pass;
1
2
to here, well, business manager let you do such a business "can be older than 16 stored in the database,"
This time, you have to use a vo
you from the first page Get dto on it, and then judge whether the age in dto is greater than 16, if it is greater than 16, then take out the name and pass in dto, put it in vo, and then give the name and pass in vo intact entity, and then according to the value of Entity, in the database, this is the difference between the three of them.

Like
————————————————
Copyright Statement: This article is an original article of CSDN blogger "Orange Orange", following the CC 4.0 BY-SA copyright agreement, please attach the original text for reprint Source link and this statement.
Original link: https://blog.csdn.net/qq_33310931/article/details/102682160

Published 7 original articles · 69 praises · 200,000+ views

Guess you like

Origin blog.csdn.net/u014320421/article/details/105483552
Recommended