• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why we need a home interface  RSS feed

 
Gyanesh Sharma
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.
 
Balakrishnan Rengaraj
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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,
Bala
 
Jaikiran Pai
Sheriff
Posts: 10447
227
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
 
RaghuB KK
Greenhorn
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?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!