GeekInterview.com
   Home |  Tech FAQ  |   Interview Questions |  Placement Papers |  Tech Articles |  Learn |  Freelance Projects |  Online Testing |  Geeks Talk |  Job Postings |  Knowledge Base | Site Search |  Add/Ask Question

GeekInterview.com  >  Interview Questions  >  J2EE  >  EJB
Go To First  |  Previous Question  |  Next Question 
 EJB  |  Question 57 of 175    Print  
Why does EJB needs two interfaces(Home and Remote Interface)

  
Total Answers and Comments: 9 Last Update: August 22, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
March 29, 2005 09:26:04   #1  
Nirdosh        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
Home is to provide Lookup from JNDI while Remote is to provide Object Instantiated
 
Is this answer useful? Yes | No
March 30, 2005 06:12:49   #2  
Vani        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
The client cant deal with the bean diirectly. All the client calls are intercepted by the container. This layer of interception is EJBObject. For the container to create EJBObjects , it should know all the business methods of the bean. So the bean provider will have to write a REMOTE INTERFACE with all the beans business methods. 
In distributed envt,we will not know where the EJBObjects are located. So we need HomeObjects which implement the Home Interface to get a handle for EJBObjects

 
Is this answer useful? Yes | No
April 04, 2005 14:08:01   #3  
Anbarasan        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
An indirection can solve almost all the problems in computer science. This is also such a type of problem. In case of only one interface (as in the case of RMI), the client has to maintain all the references of the EJB objects (i.e. remote objects) which will be cumbersome in large distributed environment and requires lot of overhead. Hence to look up the references, a home interface is introduced as an indirection. Each and every client first looks up for the remote object reference in the JNDI tree and then gets the reference. The EJBObject reference is returned to the requesting clilent. And also, in J2EE, we can use the EJBObject reference once created to serve n number of clients.
 
Is this answer useful? Yes | No
May 09, 2005 04:11:13   #4  
Hari        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
Two interfaces are required to seggregate the business methods to be exposed to client and to maintain the life cycle of the bean. 
 
Remote - to expose the business methods to clients 
Home - to maintain the life cycle of the bean.

 
Is this answer useful? Yes | No
June 15, 2005 13:33:45   #5  
RajeshRokkam        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
Home Interface--To locate the bean. 
Remote Interface--To expose the business methods of the bean.

 
Is this answer useful? Yes | No
September 03, 2005 04:15:22   #6  
Priti        

RE: Why does EJB needs two interfaces(Home and Remote Interface)
Home interface for the client and the Remote Interface for the container.
 
Is this answer useful? Yes | No
November 12, 2005 04:43:18   #7  
abhi        

RE: Why does EJB needs two interfaces(Home and Remote ...
Actually Home interface are used as a Factory to get Bean reference. However since the Bean class/object is not available to the client it uses the remote interface to hold the bean reference
 
Is this answer useful? Yes | No
April 18, 2006 08:58:23   #8  
Viresh        

RE: Why does EJB needs two interfaces(Home and Remote ...
read Mastering EJB3 book An excellent refrence for all ejb enthusiasts but with limited knowledge. its available free at theserverside.com.
 
Is this answer useful? Yes | No
August 22, 2006 09:00:48   #9  
Nandikonda Laxman        

RE: Why does EJB needs two interfaces(Home and Remote ...

I would say that the main reason is because there is a clear division of roles and responsibilities between the home and remote interfaces of an EJB.

The home interface allows the client to communicate with the container which is responsible for creating, finding and removing beans. Whereas the remote interface is the way to communicate with the bean that will allow to remotely access to all its methods. Therefore you need two interfaces for two different purposes i.e) home interface to communicate with the container and remote interface to communicate with the bean.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 




About Us  |   Privacy Policy  |   Terms and Conditions  |   Contact  |   Site Map  |   Add Question  |   Propose Category  |   RSS Feeds  |   Articles Sitemap  |   Site Updates  |   Add Resource

Copyright © 2005 - 2008 GeekInterview.com. All Rights Reserved
Page copy protected against web site content infringement by Copyscape