• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Remote and Home Interfaces

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand what remote and home interfaces are, their methods and mechanics. My question is why EJB needs two interfaces (four interfaces in the case of EJB 2.0)?
 
Ranch Hand
Posts: 8944
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Home interface is used for finding,creating and removing EJB'S whereas Remote i/f containd business methods.

Originally posted by JiaPei Jen:
I understand what remote and home interfaces are, their methods and mechanics. My question is why EJB needs two interfaces (four interfaces in the case of EJB 2.0)?

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

Originally posted by JiaPei Jen:
I understand what remote and home interfaces are, their methods and mechanics. My question is why EJB needs two interfaces (four interfaces in the case of EJB 2.0)?


We'll, remote interfaces use RMI (Remote Method Invocation). Prior to EJB 2.0, all communication was done with RMI. This adds a lot of overhead and puts a lot of information (java objects) on the network. Every call to Entity bean would be an RMI call, even if the bean was in the same container.
With local interfaces, the app server is now aware that the Entity bean is in the same server and does not need to make an RMI call to access it or run a method. All Entity bean calls happen in the server, so there is no overhead related to RMI in this situation.
HTH and didn't confuse you more,
/rick
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I said that I understood what EJB interfaces and what they did. My question is not answered. My question is "why EJB needs those interfaces". Anybody could shed light?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is purely to segregate the functionality that each is performing.
Home as
1)Factory of Remotes
2)life cycle management of beans
Remote as
1)reference to bean instance
2)business methods
The concept of factory and remote comes from CORBA.
 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the answer is: Container provides functions as a proxy between ejb callers and the ejb. the interfaces are implemented by the Container. container generates some classes and their stubs. Those classes' stubs are sent to the client. Thus, Container can add in multiple functions such as Transaction, Persistence Management, Security and various optimization like poolings.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic