my dog learned polymorphism
The moose likes Beginning Java and the fly likes what is POJO?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "what is POJO??" Watch "what is POJO??" New topic

what is POJO??

divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87

What is POJO? I was using EJB in my project then some body suggest me to use POJO.



Edwin Dalorzo
Ranch Hand

Joined: Dec 31, 2004
Posts: 961
From Wikipedia:

POJO is an acronym for Plain Old Java Object, and is favoured by advocates of the idea that the simpler the design, the better. The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in particular not an Enterprise JavaBean (especially before EJB 3). The term was coined by Martin Fowler, Rebecca Parsons and Josh MacKenzie in September 2000.
divya sharma
Ranch Hand

Joined: Jan 25, 2007
Posts: 87
Please elaborate some more coz i could not find much about it in google.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15087

Do you know what Enterprise JavaBeans (EJBs) are?

Before EJB version 3, the EJB API was very complicated. To create an EJB you had to write multiple classes and interfaces in which you had to implement special methods, and you also had to write a complicated XML deployment descriptor for your EJB.

That complexity made EJBs not very popular. So EJBs, especially entity EJBs, got out of fashion, and simpler frameworks and libraries such as Hibernate and the Spring Framework became popular.

With these, you could forget about the complex magic needed to write EJBs; instead, you could use simple, normal Java objects (POJOs = Plain Old Java Objects).

Sun has learned from this, and in version 3, EJBs have inherited many of the features of Hibernate, which makes it much easier to write them. A v3 EJB is not much more than a simple POJO with annotations. No need to write home and remote interfaces and XML deployment descriptors, as with old-style EJBs.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Originally posted by divya sharma:
Please elaborate some more coz i could not find much about it in google.

Please use real words when posting to the forums. Abbreviations such as "coz" in place of "because" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

JavaRanch sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Srikanth Nittala

Joined: Sep 24, 2006
Posts: 22
This book is a terrific read on POJOs.

POJOs in Action
Developing Enterprise Applications with Lightweight Frameworks
Chris Richardson
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
There really isn't much more to it than described in

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I actually read a book a few years that talked about POJOs constantly, and never explained the term. I mean, I went back to find one, just one place where they defined it. I didn't know what on earth they were talking about. I mean, you can't exactly sound it out and make sense of it.

Plain Old Java Object. I've seen Plain ordinary Java Object used as well.

The idea is, many frameworks complicate processes by using XML and Homes and Interfaces and stubs and skeletons and this and that and the other thing, when in reality, quite often a very simple, plain old Java object would probably do the trick just as well, be more efficient, and be easier to manage in the long run.

-Cameron McKenzie
I agree. Here's the link:
subject: what is POJO??
It's not a secret anymore!