• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why we need home and remote interfaces in EJB?

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I would like to know why we have home and remote interfaces in EJB.
Can't we achieve the same functionality with a single class?

Is there a particular reason why these interfaces were introduced in EJB.

Cheers
Kunal
 
Bartender
Posts: 1357
39
IBM DB2 Netbeans IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

you're right. If you go and visit SUN web site, you'll see that EJB 3.0 specification (next to come..) will reduce a lot the complexity in creation, lookup, and deploy of EJBs.

Best regards,

Claude.
 
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Kunal,


I would like to know why we have home and remote interfaces in EJB.
Can't we achieve the same functionality with a single class?


A short fast answer would be �because J2EE is silly� or maybe �because J2EE specifications were written by people that are brilliant technical minds but they lack simplicity, flexibility and easy marketing going�. However the reason, the original idea was that the home interface is kind of object creation factory. Imagine the container that needs to pool all these bean instances. Now you have to connect your clients to one of them. Obviously your client needs a way to identify an instance in the pool. A single unique RMI interface won�t going to help. Look at the RMI for example: there is the server and the client that implements the same interface, the server listens at a specified port number, etc. No instance pooling in this case, just a many-to-one relationship between the clients and the server component. Well ejb wants to improve this concept and therefore introduced the instance pooling and home interfaces. The real question actually is: did it improve that much by using bean instance pooling? A closer look, deeper analyzes and basic profiling tools might show and prove that it actually didn�t.
Regards.
 
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kunal Verma:
Can't we achieve the same functionality with a single class?



Ofcourse, you can. You can also, go ahead and write a complex application with a single class. But isn't it better to split up things based on their responsibilities?
The home interface, is used to interact with the container (creating bean, locating etc), where as the remote interface is used to interact with the bean . As you can see, the roles they play are different, and hence they are seperate.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic