Home Logo
What is Plain Old Java Object (POJO)?
Posted by: Santosh Kumar On: 10/22/2013
Tags: Java SE, Java EE, Spring, POJO
 5 of 5 (5 votes)
Visits: 7153    25

What is Plain Old Java Object (POJO) ?


The term POJO was composed by Martin Fowler, Rebecca Parsons, and Josh MacKenzie in the year of 2000.

Martin Fowler has described about the term POJO in his blog as:

The term was coined while Rebecca Parsons, Josh MacKenzie and I were preparing for a talk at a conference in September 2000. In the talk we were pointing out the many benefits of encoding business logic into regular java objects rather than using Entity Beans. We 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.   --- Martin Fowler

The term POJO started in this way by the three great authors, and now it is a very commonly used term in the world of Java.


Define : The term POJO is used to refer an object that is an ordinary Java object, not a special object.

The definition looks simple but there is a great confusion in the community regarding the usage of this term; regarding what is the meaning of special object.


Lets look into a simple example.

As per the definition the following class is a POJO with no doubt.

   1: public class MyBean {...}

This is very clear that the MyBean object shown above is a POJO.


Lets take one more example:

   1: public class MyBean implements MyIntf {...}

What do you feel about this?

Some people argue that the MyBean object shown above is not a POJO as it implements an interface 'MyIntf'. As they feel like an object of a type implementing / extending any interface or a class is not a POJO. :)

Some other express that this is a POJO as it is not implementing the predefined API (interface).


My view on this point is, by just implementing / extending any interface / class an object type cannot be described that it is not a POJO. If that is the case most of the objects that we implementing into the project which are managed by the containers like Spring Core Container (that claims to manage POJOs) are programmed to interface; we know that P2I (Programming to Interface) is one of the good principals implementing the objects. For example:

   1: public interface AccountsDAOI{...}
   3: public class AccountsDAO implements AccountsDAOI {...}

Cant we refer the object AccountsDAO as POJO?

-- As per me it is a POJO.


Lets look into one more example:

   1: public class MyBean implement javax.servlet.Servlet {...}

Now what about this? Is the object MyBean POJO or not?


An object subtype of javax.servlet.Servlet interface could be special to Servlet Container but not to every other container such as Spring Core Container.

Recalling the definition of the term POJO 'The name is used to emphasize that a given object is an ordinary Java Object, not a special object.'

Thus this is considered as POJO with respect to the Spring Core Container, but the same is a Servlet Object (Special Object) not a POJO for Servlet Container.

This is what creates a confusion.

Avoiding this confusion; as per me a POJO can be defined simply as;

A Java object that is created using the Java Language Rules and no additional rules from the underlying container (or framework) is known as POJO.


Please write your views on this as comments.


Thank you
Santosh Kumar K
Website : www.santoshtechnologies.com
Email : tosantoshk@gmail.com

About the Author
 Santosh Kumar



Santosh Kumar K is currently associated with SANTOSH technologies, a prestigious training division at Ameerpet, Hyderabad, imparting specialized training in Java and its related frameworks useful for enterprise application development. He has been associated with training and development on Java and its related technologies since 2001 and was pioneer in introducing full-fledged training on Spring and

Hibernate Frameworks at Hyderabad. He has conducted training programs for the corporate sector involved in enterprise application developments on J2EE technologies and other frameworks like Struts, JSF, Spring, and Hibernate. His seminars and workshops are well known for their high-quality content backed by his unique style of delivery. He has also worked as an independent consultant developing critical applications for companies such as InnoMinds, Satyam, and ESoft. He is the author of JDBC, Servlets and JSP BlackBook, and Spring And Hibernate published by TATA McGraw-Hill.

Santosh is the founder of SANTOSH technologies (http://www.santoshtechnologies.com) started with the motto to provide quality education with a high technical content and deliver technology driven business solutions. 

Article Top
Rate this Article Here: 

very nice sir
By:  Satyajit Sutar    On: 10/21/2013
thanks a lot sir for this
By:  ajay kumar yadav    On: 10/21/2013
Thank you sir... You are absolutely right sir most of the student especially from Ameerpet have wrong concept. They are taught likethat they don't even except the right concept.... Thanks for being there.
By:  Sanjay Swain    On: 10/22/2013
Thanks Sir, all my confusion about pojo is clear now !
By:  Shambhu Madheshiya    On: 10/22/2013
Now i could come out from the confusion about the POJO. It was injected... Thanku sir.
By:  NAGA RAMU    On: 10/22/2013
public class MyBean implements java.io.Serializable{..} is not depending on any external container rules or any other framework rules. So, can I say it as POJO? @Santosh Sir
By:  Arun Kumar    On: 10/22/2013
@ Arun, Yes, you can say it as POJO unless and until the underlying system (like Java Bean API) enforces to have implementing Serializable and also consider such object as a special object compared to other.
By:  Santosh Kumar    On: 10/22/2013
Thank you Sir
By:  Sharat Mohanty    On: 10/22/2013
Thank You sir....
By:  jagnya datta    On: 10/22/2013
got rid of half knowledge.....thank u sir.
By:  Dinesh Biswal    On: 10/24/2013
Thank you sir ...
By:  Mohammad Mustafa Muzafar    On: 10/26/2013
Thank you sir for giving such a descriptive clarification.
By:  Supriya Jena    On: 10/29/2013
Does POJO class implement Serializable interface..? If Yes, then Why ? As we are saying POJO class doesn't implemnt any interface , classes .
By:  Prakash Sahu    On: 11/8/2013
sir..what is the difference b/w Pojo,Poji and java bean?
By:  munalal behera    On: 12/3/2013
what is the diff b/w pojo,poji and java bean ?
By:  munalal behera    On: 12/3/2013
@Santosh Sir, Meaning anything java class object is a POJO which will be vary with respect to the scenario we use it, by default any java object is a POJO right ?
By:  raju thoutu    On: 12/22/2013
Simply saying; Every normal java class can be treated as a POJO class which can not be binded with any Technology or any framework. Meaning is the class should neigher extend or implement any interface or a class provided by a technology or a framework. Off course a normal java class can implements maximum of Serializable interface, that is also definitely a POJO class, There is no even a single doubt et-all . Ex1:- class A implements java.lang.Serializable {}, here this class definitely a pojo class..Ex3- class B extends Exception {}, Here class B 100% is a POJO class But Ex3-- class C implements javax.servlet.Servlet{}, Here class C is not a POJO.
By:  sonu kumar    On: 1/5/2014
Dear Sonu Kumar, Still you are mistaken. Why class C implements javax.servlet.Servlet is not POJO? When class A implements java.io.Serializable is 100% POJO; why not C? Except with respect to the Servlet container and Java Serializer class A and C are same refereed as POJO.
By:  Santosh Kumar    On: 1/11/2014
@Santosh sir, as i know 'Serializable' interface is belongs to java language, But in the case of 'Servlet' it is belongs to java technology. And as per my knowledge a class will be POJO if that class doesn't binded with any framework or any technology..
By:  sonu kumar    On: 1/11/2014
Please clarify this concept any mistake found
By:  sonu kumar    On: 1/11/2014
@Sonu Kumar, what do you mean by Serilaizable belongs to Java language, and is Servlet not implemented in Java? According to you what is the difference between Java Language and Java Technology? Is serialization not a technology?
By:  Santosh Kumar    On: 1/12/2014
@Santosh sir, A Java language which provides an environment to execute their application by using their interpreter But to execute a program which has written binded with a Java technology they need to take the help, from other third party which will provide the environment for it. So Serializable is belongs to java language, off course Servlet is implemented in java only but to run this Servlet we can not use java interpreter. Now when we talk about serialization, then this is one of the technique but not a technology. Please clarify if any thing wrong..!
By:  sonu kumar    On: 1/12/2014
@Sonu Kumar, i am sorry to say you are theory is not correct. First of all Java Serialization is one of the Java Technologies for marshaling Java Objects, which also can be know as technique. And next about what do you mean by ' to run this Servlet we can not use java interpreter' ok let me ask you in your way, according to you if a class extends java.applet.Applet is it a POJO or not?
By:  Santosh Kumar    On: 1/13/2014
@Santosh sir, Thank you for your feedback. it seems to me, java.applet.Applet is a POJO. When we come to 'environment' then, i mean to say that an applet program can be execute by using the tools given as a part of core java. But in the case of Servlet, there is no tools available as part of core java to execute Servlet. and sir one more thing, i don't have more knowledge about Applet. and thank's again to making me understand that serialization is one of the technology. sir i am waiting from your response once again.
By:  sonu kumar    On: 1/13/2014
very nice sir..............
By:  nitish jaiswal    On: 1/16/2014

Comments Using Facebook

Top Members
View All
Recent Articles
View All
Comming Soon
View All
Quick Keywords
Breaking News
View All
Recommended Books
View All
Find Us On Facebook