Pojo Class (Plain ordinary Java object)

Source: Internet
Author: User
Pojo has some private parameters as properties of the object. The Get and set methods are then defined for each parameter as an interface for access. For example:
public class User {
Private long ID;
private String name;
public void SetId (long id) {
This. id = ID;
}
public void SetName (String name) {
This. Name=name;
}
Public long getId () {
return ID;
}
Public String GetName () {
return name;
}
}

Pojo objects are sometimes referred to as data objects, and are used in large numbers to represent objects in reality. If the hibernate framework is used in the project, there is an associated XML file that corresponds to the table in the database, and the properties of the object correspond to the fields in the table.

In general, when building a database mapping object in a Web application, we can only call it Pojo. Ordinary Java classes, which have a part of the Getter/setter method, can be called Pojo. Pojo is a simple generic Java object that does not contain business logic or persistent logic, but is not javabean, Entitybean, etc., and does not have any special roles and classes or interfaces that do not inherit or implement any other Java framework. The abbreviation is more direct. There are classes of properties and their getter setter methods, there is no business logic and can sometimes be used as VO (value-object) or DTO (Data Transform object). Of course, if you have a simple arithmetic attribute is also possible, However, there are no business methods, nor can we carry methods such as connection.

Pojo Class (Plain ordinary Java object)

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.