Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Why we need a home interface

Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to EJB so this mind sound dumb to most of the ranchers out there. Can someone please tell me why we can't do a JNDI lookup of the component interface and narrow the stub and call the business method instead of getting a home interface and creating a component interface stub.

I know it is the way EJB is designed. I just want to know what is the purpose behind it.
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i hope you know the concept of EJB.. when you call create method of home interface, it actually calls the Home object which is called as EJBObject factory..

This Home object will create or refer to the EJBObject based on the Pooling Concept.. EJBObject is limited one. So container use the Pooling Concept to serve the EJBObject..

Now your question:

What is the need of Home Interface?

Any point of time there will be only one Home Object is alive in Container like a singleton Object. So container memeory will be saved by doing like this.

As per your suggestion, giving the direct access to EJBObject, which may throw a InsufficientMemoryException or customer has to wait to get a EJBObject if some millions of clients call the bean at the same time.

And the second advantage is location transparency.. The client doesn't know where will be the bean's deployed..

I hope this will help to clear your doubts.. If not,Feel free to ask

with regards,
Posts: 10445
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at the Section "The Home Object" in "Mastering EJB2" book by EdRoman. This section will answer your question. You can find a pdf version of the book here
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bala ,
Are u sure that EJBObjects are limited one and depends pooling concept.
Is that EjbObject or Bean you want to say?
I didn't do it. You can't prove it. Nobody saw me. The sheep are lying! This tiny ad is my witness!
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic