Differentiation of various Java objects (PO, Bo, VO, dto, POJO, Dao, entity, JavaBean, JavaBeans)

Po: persistent object. Po (persistent object) is the entity in the object / relationship mapping framework. Each attribute of Po basically corresponds to a field in the database table. It is a pure Java object that conforms to the Java Bean specification without adding other properties and methods. Persistent objects are created by the insert database and deleted by the delete database. Basically, the life cycle of persistent objects is closely related to the database.

Vo: value object, which is usually used for data transfer between business layers. Like Po, it only contains data. However, it should be an abstract business object, which can correspond to the table or not, depending on the needs of the business.

The view object mainly corresponds to the data object displayed on the display interface. A VO object is used to encapsulate the object data required for the display of the whole interface.

Bo: abbreviation of business object layer. It is a Java object that encapsulates business logic. Business operations are carried out by calling Dao methods and combining Po and VO. See an example on the Internet:

For example, a resume with educational experience, work experience, social relations, etc. We can map education experience to a PO, work experience to a PO and social relations to a PO. Create a Bo object corresponding to the resume to process the resume. Each Bo contains these POS. When processing business logic in this way, we can process Bo.

Dto: data transfer object, a software application system that transfers data between design patterns. The target of data transmission is often to retrieve data from the database. The difference between data transmission objects and data interaction objects or data access objects is that they do not have any behavior except the stored and retrieved data (accessor and accessor). In short, when we need the content of 10 fields of an object, but the object has a total of 20 fields, we do not need to transfer all the fields of the whole Po object to the client. Instead, we can re encapsulate and transfer them to the client with dto. At this time, if this object is used to correspond to the presentation of the interface, it is called vo.

JavaBean: a reusable component, that is, "write once, execute anywhere, reuse anywhere". Three conditions are met: ① the class must be concrete and public; ② it has a parameterless constructor; ③ the public method that provides a consistent design pattern exposes the member attributes of the internal domain.

Main purpose: it can be used in function, processing, value, database access and JSP. Any object that can be created with java code.

There are two types: one is a JavaBean with a user interface (UI), and the other is a JavaBean without a user interface, which is mainly responsible for handling transactions (such as manipulating databases). JSPS usually access the latter JavaBean.

Classification: there are usually three categories: session bean, entity bean and messagedrivenbean

JavaBeans: in a narrow sense, JavaBeans refers to the JavaBeans specification, which is located in Java A set of APIs in the beans package. Broadly speaking, JavaBeans refers to API collections, such as Enterprise JavaBeans.

POJO: POJO (plain ordered Java object) is a simple java object, which is actually ordinary JavaBeans. It is an abbreviation created to avoid confusion with EJB. It generally refers to ordinary Java objects that do not use entity beans. POJO can be used as an assistance class to support business logic.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>