Thursday, May 17, 2012

J2EE - PO, BO, VO, DTO, POJO and DAO concept

PO ( Persistent Object )
A PO data library record.
The advantage of the record as an object processing, can be easily converted into other objects.

BO ( Business Object )
The main role is to encapsulate the business logic for an object. This object can include one or more other objects.
Such as a resume, education, experience, work experience, education experience corresponds to a the PO and work experience correspond to a PO.
Establish a corresponding CV BO object processing resumes, each BO contains the PO.
So deal with business logic, we can for BO to deal with.

VO ( Value Object )
The ViewObject performance layer object corresponds to the interface to display data objects. For a WEB page, or SWT, SWING interface, with a VO object corresponding to the value of the entire interface.
Entity and the VO:
Entity with the Identity, the VO did not take the Identity that is Entity only transaction Identity considered as different objects, but as long as the VO attribute is changed, it is regarded as a different object

The DTO ( Data Transfer Object )
Mainly used in place of the remote call and need to transmit large amounts of objects.
For example, our one table has 100 fields, then the corresponding PO has 100 properties.
Our interface as long as 10 field, the client access to information, WEB service does not require the PO object passed to the client.
That can use only 10 attributes DTO to pass the results to the client, so would not be exposed to the service end of the table structure. To reach the client, if this object to the corresponding interface display, and that its identity into the VO

POJOs ( Plain Old Java Object or the Plain Ordinary Java Objects)
Attributes and getters, setters of Java Objects
A POJO persistence after a PO
Pass it directly, the transfer process is the DTO
Directly used to map the presentation layer is the VO

DAO ( Data Access Object )
Mainly used to encapsulate the database access. It can POJO persistence into the PO, PO assembly of the VO, the DTO

1 comment: