This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is POJO??

 
divya sharma
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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

Thanks

Divya
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please elaborate some more coz i could not find much about it in google.

Thanks!!!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15437
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

thanks,
bear
JavaRanch sheriff
 
Srikanth Nittala
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This book is a terrific read on POJOs.

POJOs in Action
Developing Enterprise Applications with Lightweight Frameworks
Chris Richardson
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There really isn't much more to it than described in http://martinfowler.com/bliki/POJO.html
 
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper
Posts: 4968
1
Hibernate Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic