Various concepts Pojo, JAVABEAN, DAO, DTO, PO, VO, BO, SSH, EJB

Source: Internet
Author: User
Tags one table


POJO
(Pure old Java object)
is an ordinary Java class, there are some private parameters as properties of the object, and then for each parameter defines the interface that the get and set methods access.

I see this definition, the heart has a question, this pojo and javabean definition how so like? What is the difference between the two?
Pojo is actually a simpler class or interface that is purer than JavaBean. Pojo strictly adheres to the concept of simple objects, while some javabean tend to encapsulate some simple logic.

JavaBean is a reusable component written in the Java language. Its method naming, construction and behavior must conform to a specific convention:
1. This class must have a public default constructor.
2. The properties of this class are accessed using getter and setter, and other methods conform to standard naming conventions.
3. This class should be serializable.
In short, when a pojo is serializable, there is an argument-free constructor, and when the getter and setter methods are used to access the property, it is a javabean.

Maybe some people don't understand what is serializable and can see my other blog http://my.oschina.net/pacoyang/blog/151649

DAO (data Access Objects)
DAO is a data Access object, and DAO generally has an interface and an implementation class for that interface, which is used to standardize the implementation class. The implementation class is generally used to manipulate the database, such as modifying, adding, deleting, and so on, generally calling public class DAO directly.

What is a DTO (data transfer object), what is VO (Value object), what is a PO (persistent object)?
We use DAO to persist Pojo to Po, with PO assembled VO, DTO.

In summary, I think an object is what o to see the specific environment, in different layers, different applications, the identity of the object is not the same, and the transformation of the identity of the object is also very natural. Just as you are a husband to your wife, you are a child to your parents. These concepts are designed not to bluff but to better understand and deal with the various logic, so that we can better to use object-oriented approach to deal with the problem.

For example, if we have 100 fields in a table, then the corresponding PO has 100 attributes. However, as long as we display 10 fields on the interface, the client uses WebService to fetch the data, and there is no need to pass the entire PO object to the client, we can pass the result to the client with a DTO with only these 10 attributes. This also does not expose the service-side table structure. After reaching the client, if the object is used to display the corresponding interface, then its identity will be converted to VO.

What is Bo (business object)?

Bo:pojo in the business layer, for business operations, more is to wrap objects from the business, such as a user Bo, may include name, age, sex, privilege, group, etc., these properties in the database may be in more than one table, Because each table corresponds to a PO, our Bo needs the PO to be combined (or re-assembled) to become a complete object in the business.

Ejb

EJB (Enterprise JavaBean): I think it is a set of "features" JavaBean. It says that JavaBean is a Java object that implements a specification. It is said that EJB is a set of JavaBean, which means that this group of JavaBean is combined to implement the business logic of an enterprise group. A group of JavaBean here is not a mess, they need to meet a business function to achieve the collocation. For example, for a dress, including a hat, a dress, a pair of trousers, two shoes. This dress is EJB, and the other is a JavaBean

The difference between SSH and EJB

EJB is a javabean combination specification, and SSH is a combination of 3 framework jar packages.

EJB itself is the specification of Java EE, which is implemented by the container manufacturer, that is, using EJB, Java EE server is required. And with SSH, directly with the Web server, SSH to resolve the target and EJB is consistent. EJBs are large, and SSH is lightweight.

Various concepts Pojo, JAVABEAN, DAO, DTO, PO, VO, BO, SSH, EJB

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.