POJO, JAVABEAN, Entity, domain, DTO, ejb classification

pojo: (Plain Ordinary Java Object) A simple Java object is actually an ordinary JavaBeans, which is an abbreviation created to avoid confusion with EJB.
There are some classes of properties and their getter and setter methods, which have no business logic, and can sometimes be used as VO (value-object) or DTO (Data Transfer Object). Business methods are not allowed, and methods such as connection cannot be carried.

javabean: javaBean is a reusable component written in the Java language. To be written as a JavaBean, a class must be concrete and public, and have a parameterless constructor.

entity: entity bean, generally used for ORM object relationship mapping, an entity is mapped into a table, generally without business logic code.

domain:domain is also a representation of javabeans 

DTO: Data Transfer Object. It is a software application system that transmits data between design patterns. Data transfer targets are often data access objects to retrieve data from a database

ejb: ejb is part of JavaEE and defines a standard for developing component-based enterprise multi-applications. It is called Java Enterprise Bean, which is the core code of Java, namely Session Bean, Entity Bean, and MessageDriven Bean.

VO:value object value object. It is usually used for data transfer between business layers. Like PO, it only contains data.

PO: persistent object Persistent object, can be seen as a java object mapped with the table in the database.

DAO:data access object Data access object, this object is used to access the database. Usually used in conjunction with PO, DAO contains various database operation methods

 

 

 

PO: The most vivid understanding of
persistant object
is that a PO is a record in the database.
The advantage is that a record can be treated as an object and can be easily converted to other objects.


BO: The main function of
business object
is to encapsulate business logic into an object. This object can include one or more other objects.
For example, a resume, with educational experience, work experience, relationships, etc.
We can map educational experience to a PO, work experience to a PO, and relationship to a PO.
Create a BO object corresponding to the resume to process the resume, and each BO contains these POs.
When dealing with business logic in this way, we can deal with BO.


VO:
value object value object
ViewObject presentation layer object
mainly corresponds to the data object displayed on the interface. For a WEB page, or an interface of SWT and SWING, use a VO object to correspond to the value of the entire interface.

DTO:
Data Transfer Object The data transfer object
is mainly used for remote calls and other places where a large number of transfer objects are required.
For example, if our table has 100 fields, then the corresponding PO has 100 attributes.
However, we only need to display 10 fields on the interface, and the
client uses WEB service to obtain data. There is no need to pass the entire PO object to the client.
At this time, we can use the DTO with only these 10 attributes to pass the result to the client. This will not expose the server-side table structure. After reaching the client, if this object is used to display the corresponding interface, then its identity will be changed to VO


POJO:
plain ordinary java object
I personally feel that POJO is the most common and changeable object, an intermediate object, and the object we deal with most often.
After a POJO is persisted, PO
directly uses it to transfer, and DTO is directly used to correspond to the presentation layer during the transfer process, which
is VO


DAO:
data access object data access object is
the most familiar to everyone. It is the most different from the above O. There is basically no possibility and necessity of mutual conversion.
It is mainly used to encapsulate access to the database. Through it, POJO can be persisted as PO, and VO and DTO can be assembled with PO

 

1. javaBean
javaBean is a reusable component written in Java language. To be written as a JavaBean, a class must be concrete and public, and have a parameterless constructor. JavaBeans expose member properties from internal fields by providing public methods that conform to consistent design patterns. More of a specification, a java object that contains a set of set and get methods. javaBean can make applications more object-oriented, encapsulate data, separate application business logic and display logic, and reduce development complexity and maintenance costs.
2, ejb
is EnterpriseBean, which is Enterprise JavaBean (EJB).
ejb is part of JavaEE and defines a standard for developing component-based enterprise multi-applications. It is called Java Enterprise Bean, which is the core code of Java, namely Session Bean, Entity Bean, and MessageDriven Bean.
3. pojo
(Plain Ordinary Java Object) A simple Java object is actually an ordinary JavaBeans, which is an abbreviation created to avoid confusion with EJB.
There are some classes of properties and their getter and setter methods, which have no business logic, and can sometimes be used as VO (value-object) or DTO (Data Transfer Object). Business methods are not allowed, and methods such as connection cannot be carried.
Compared with javaBean, javaBean is much more complicated. JavaBean is a reusable component. There is no strict specification for JavaBean. In theory, any Java class can be a Bean. But in general, since JavaBeans are created by the container, JavaBeans should have a no-argument constructor. In addition, usually JavaBean also implements the Serializable interface for Bean persistence. Generally, when creating a database mapping object in a web application, we can only call it POJO. It is used to emphasize that it is a common object, not a special object, which is mainly used to refer to java objects that do not conform to a specific java object model, convention or framework (such as EJB). Ideally, a POJO is an unrestricted java object
4, entity
entity bean, generally used for ORM object relationship mapping, an entity is mapped into a table, generally no business logic code.
Responsible for mapping table records in the database to Entity objects in memory. In fact, creating an EntityBean object is equivalent to creating a record. Deleting an EntityBean object will delete the corresponding record from the database at the same time. When an Entity Bean is modified, the container will automatically Synchronize the state of the Entity Bean with the database.
5. DTO
data transfer object (Data Transfer Object). It is a software application system that transmits data between design patterns. Data transfer targets are often data access objects to retrieve data from a database

 

 

POJO = "Plain Old Java Object", is a term invented by Martin Fowler and others to represent ordinary Java objects, not JavaBeans, EntityBeans or SessionBeans. POJO not only acts as any special role, but also does not implement any special Java framework interface such as EJB, JDBC and so on. 
   
  That is, POJO is a simple ordinary Java object, which contains business logic or persistence logic, etc., but is not JavaBean, EntityBean, etc., does not have any special role, and does not inherit or implement any other Java framework class or interface. 
   
   
  VO: is the Value Object. It mainly refers to the data submitted by the user, such as the submitted form data, which are all stored in a class called VO. Usually, one VO can correspond to multiple POs (the concept is similar to POJO). 
   
  -------------------------------------------------- - 
   
  What is the relationship between POJO, VO, PO, FormBean I 
  read the book on web development and found these words. Makes me wonder. What do these terms mean, and what does it matter? 
   
  After reading some documents, I have the most basic understanding of their basic concepts. 
   
  POJO: Pure Old Java Object, a simple Java object that conforms to the Java Bean property specification, also commonly referred to as VO (Value Object). 
   
  PO: Persistent Object, persistent object. 
   
  The difference between VO, PO, and FormBean: VO is an independent Java Object; PO is an object that Hibernate incorporates into its Entity Map. It represents a Hibernata entity corresponding to a record in the database, and changes in PO will be reflected in the actual database when the transaction is committed. FormBean is just the encapsulation of the form in HTML, in order to weaken the function of storing data in the request, and convert the get() method of the request object into the access value of the object. 
   
  There is no difference between VO and PO in terms of structure. But it is fundamentally different. 
   
  VO is created by the new keyword and reclaimed by the GC. PO is created when new data is added to the database, and deleted when data in the database is deleted, and it can only survive in one database connection, and it is destroyed when the connection is disconnected. 
   
  VO is a business object, used by business logic, and its purpose of survival is to provide a place for data to live. PO is the representation of data objects, which can simplify the conversion of object data and physical data. 
   
  The attributes of VO vary according to the current business. The attributes of PO are in one-to-one correspondence with the fields of the database table. PO objects need to implement the serialization interface. 
  Domain is also a representation of javabean 
    : data access Object is a java class that implements business logic in the background; 

    corresponding to DAO, there is also a DTO which is Data transfer Object, which is a 
     get and set method that defines many variables and variables The class is often used as a parameter of the process method. It can also be regarded as a custom 
     data type; 

    domain is the range, the boundary, and is also used to batch the effective scope of a variable. 
     This word is often used to make a package, and then in Put some DAO class files in it. 
    net.baidu.domain.AddUserDao 

  In Hibernate, the core concept is the state management of PO. A PO has three states: 
  1. VO that has not been persisted, which is a memory object VO at this time, and the life cycle is managed by the JVM. 
  2. The PO has been persisted, and in the Session life cycle, the database connection is mapped at this time, and the database manages the life cycle. 
  3. It has been persisted, but now the Session has been managed (detached) and is running as VO. It can also enter another Session to continue PO state management. 
   
  It should be noted that PO is best used only in the persistence layer. If it is used everywhere without the persistence layer, it will bring a lot of PO object maintenance overhead to Hibernate.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324671205&siteId=291194637