Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote and Home Interfaces

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • 0
  • Mark post as helpful
  • send pies
  • 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)?
 
Pradeep bhatt
Ranch Hand
Posts: 8927
Firefox Browser Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • 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)?
 
Rick Salsa
Ranch Hand
Posts: 173
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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?
 
ipog
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Laudney Ren
Ranch Hand
Posts: 111
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic