• Post Reply Bookmark Topic Watch Topic
  • New Topic

Difference pojo and ejb

 
Robin Ranga
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the difference between pojo's and ejb.
And how ejb's are distributable and scalable.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, welcome to the ranch!

EJB is a framework and a container. Your classes run within the context of the container. EJB is a very "intrusive" framework, meaning your classes will have many references to things that come with the container like superclasses and utilities. That makes it tough to move your code out of EJB into some other framework or to test it without firing up the whole container.

POJO means Plain Old Java Object and just means a class with no ties to the framework and container. With no imports or dependencies on the container, you can move a POJO to another framework or container and test it without starting up the container.

This distinction came about because folks tried EJB and found it too complex and too intrusive. There are a number of POJO frameworks like Spring with a goal of being less intrusive and complex. Often when you hear somebody talk about POJO they are being critical of EJB or claiming to have something simpler and better.

My team uses another framework, and we also talk about POJO as "not part of the framework". We mix minimal framework classes that delegate much of the work to POJOs. It's a tough balancing act but it can pay off.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't even touch your second question yet! EJBs are distributable or remotable because you can call them from another JVM, on the same or another computer.

They are scalable because - if you do it all carefully - the server is stateless and you can add more servers in a cluster. So if you get a thousand new users and need more capacity, you can add more server instances to the cluster. For example my project runs in 6 "clones" of WebSphere running on 3 "nodes" or computers and we're giving some thought to 12 clones in two geographic locations.

I'd suggest Ed Roman's "Mastering EJB" book, available online as a PDF if you google around a bit. Give it a try and see if it starts out where you are. If it's too advanced, ask the gang for more recommendations.

Hope that helps!
[ May 29, 2006: Message edited by: Stan James ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!