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
Joined: Nov 19, 2000
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?
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.
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.
" Veni, vidi, vici "<br />" I came, I saw, I conquered "