POJO (Plain ordinary Java Object)
A simple Java object, is actually
General JavaBeansTo avoid the short name created by the confusion with EJBS.
The POJO name is used to avoid confusion with the EJB (Enterprise JavaBean) , and the abbreviation is more straightforward. 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) To use. Of course, if you have a simple arithmetic attribute is also possible, but do not allow business methods, and can not carry a method such as connection
Pojo is a good acronym for plain Ordinaryjava object, but it refers to ordinary Java objects that do not use entity beans, and pojo can be used as an aid class to support business logic. Pojo can be understood as a simple entity class, as the name implies that the role of Pojo class is convenient for programmers to use data tables in the database, for the vast number of programmers, it is convenient to use the Pojo class as an object, of course, it is also convenient to call its Get,set method. The Pojo class also brings a lot of convenience to our configuration in the Struts framework. 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. Pojo and JavaBean differences Pojo and JavaBean are our common two keywords, generally easy to confuse, Pojo full name is plain ordinary Java object/pure old Java Object, Chinese can be translated into: Ordinary Java class, with a part of the Getter/setter method of that class can be called Pojo, but JavaBean is more complex than Pojo, Java beans are reusable components, Java beans are not strict specifications, theoretically speaking, Any Java class can be a Bean. But usually, because of the
Java Beans are created by containers (such as Tomcat), so Java beans should have a parameterless constructor, and in addition, Java beans are typically implemented with the Serializable interface to implement Bean persistence. Java beans cannot be accessed across processes。 JavaBean is a component technology, as if you have made a wrench, and this wrench will be used in many places, this wrench also provides a variety of functions (you can take this wrench wrench, hammer, pry, etc.), and this wrench is a component. In general, when building a database mapping object in a Web application, we can only call it Pojo. POJO (Plain old Java object) this name is used to emphasize that it is an ordinary Java object, not a special object, which is primarily used to refer to Java objects that do not conform to a particular Java object Model, Convention, or framework (such as EJB). Ideally, a pojo is a Java object that is not subject to any restrictions (except the Java language Specification)
Spring MVC Learning Note--pojo