Plain Old Java Object

from Wikipedia, the free encyclopedia

POJO is an abbreviation for Plain Old Java Object , ie a "completely normal" object in the Java programming language .


The expression was coined in September 2000 by Martin Fowler , Rebecca Parsons and Josh MacKenzie in order to distinguish simple Java objects from objects with various external dependencies. Such external dependencies can, for example, be interfaces that have to be implemented , naming conventions to be observed or necessary annotations . The basic idea is: "the simpler, the better" and is also known as the KISS principle .

"Whom. Fowler, R. Parsons, J. MacKenzie] wondered why people were so against using regular objects in their systems and concluded that it was because simple objects lacked a fancy name. So we gave them one, and it's caught on very nicely. "

"We M. Fowler, R. Parsons, J. MacKenzie] asked us why people were so opposed to using regular objects in their systems and came to the conclusion that there was no original name for simple objects. So we gave them one and it was very well received. "

- Martin Fowler


The term is mainly used in connection with object-relational mapping concepts and tools such as Hibernate or JDO , in which the domain model can be built from POJOs, while in contrast to entity beans, extensive conventions must be adhered to.

Freed from conventions, a POJO is understood as an object in the true sense of object orientation, i.e. H. a unit of data and behavior to which the well-known principles of low coupling and strong encapsulation are applied. A POJO is therefore usually more than just a collection of getters and setters .

Another domain in which the term POJO is used is the world of inversion-of-control containers such as Spring or PicoContainer . Here, too, “simple” Java objects should be used, while external dependencies outside these are resolved by the container.


Since November 2005, the term "POJO" has mainly been used to describe an object that does not conform to the major Java object models, conventions, or frameworks such as EJB .

A POJO is a Java object that has no restrictions except for those of the Java Language Specification . That means, a POJO should not:

  1. extend pre-specified class, such as B. here:
    public class Foo extends javax.servlet.http.HttpServlet { 
  2. implement a pre-specified interface, such as B. here:
    public class Bar implements javax.ejb.EntityBean { 
  3. contain pre-specified annotation such as B. here:
    public class Haus { 

Individual evidence

  1. ^ Martin Fowler: MF Bliki: POJO. Retrieved February 7, 2008 .