plain old Java object (POJO)
Plain Old Java Object (POJO) describes nothing more than a simple Java class without complex structures, as these are used for example with Enterprise JavaBeans( EJB). The term was coined by Martin Fowler, who already gave different terms for procedures and facts a sonorous name, in order to give these more strength in the expression. The background story can be read at the link below.
The problem of the POJOs goes back to the fact that with the further history of Java a procedure was established, which assigned Java classes not only the technical details, but implemented in these likewise technical and infrastructural code. As example various Frameworks or also the EJB in the version 2.x can be consulted. In comparison POJOs are lightweight classes, which get along without additional ballast and orient themselves only at the basic Java specification. With it are meant:
- Technical elements of any form including technically motivated Throws clauses.
- The requirement to implement callback interfaces.
- The extension of already specified classes.
- Classes that contain already specified annotations.
- The implementation of already specified interfaces.
Another acronym coined in this context is POJI, Plain Old Java Interface. This refers to a Java interface that focuses on the technical methods of an application. The declaration of technical details or structures that relate to the infrastructure of an application is explicitly excluded.
The goal of POJOs and POJIs is to simplify the development of applications in the enterprise environment again. In addition to the Java Persistence API( JPA), POJOs and POJIs are central elements in the new Enterprise JavaBeans 3.0 specification, and demonstrate there the ease of developing EJBs. Similarly, POJOs are central to the persistence concepts ofHibernate and Java Data Objects( JDO). Another example is also the approach of the Spring framework, where domain-oriented classes are implemented as POJOs.