• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Why two interfaces in EJB?.......help needed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all
I have started reading ejb from Oreilly and i am wondering on one question why there are seperate 2 interfaces Home and Remote why not there can be only one combined interfaces.
Also can any one give me good faq and answers on ejb so that i can prepareit interview point of view also
by....
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
The two interfaces are there for specific reasons. When using EJB, all clients make requests through a remote interface (the ones you create). The remote interface has the same method signatures as your Enterprise Bean class.
The Home interface serves as a factory for creating EJB objects. EJB objects are basically request interceptors. The EJB object is created by the EJB container and implements your remote interface.
When the client invokes a business method on your bean, they are actually making a call on the remote interface, which is passed to the EJB Object. The EJB object takes care of all the middleware issues, like transactions, security, etc. It then delegates the request to your bean class which does its job and sends back a response.
Allowing clients to interact directly on your beans is not a good thing. This is the reason for all these interfaces. Without them, you'd be left to take care of thread safety, transactions, etc....
Hope that helps,
/rick
P.S. It's probably not my place, but you should change your user name to comply with the ranch's policy. That is, your user name is: "FirstName LastName"
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whizkid,
JavaRanch has a required naming standard. You must use your real first name - space - your real last name. Please update your display name. Thanks.
 
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rick Silva:
EJB objects are basically request interceptors.
.....................
The EJB object takes care of all the middleware issues, like transactions, security, etc.


Is it EJB object(s)' or container's job?
This question is rather FAQ (cf. here but I do not think it was answered: why two? They could be combined in one.? The presence of interface is not the synonym of possibility to intercept requests...
[ January 21, 2003: Message edited by: yidanneuG ninaV - just fixed the broken link]
[ January 22, 2003: Message edited by: Guennadiy VANIN ]
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, I believe that EJBs use RMI-IIOP as the underlying protocol to communicate with the remote computer.
If you skim over the material on RMI-IIOP, you will note that they use the concepts of 'remote' and 'home' as part of the protocol.
Robert Troshynski
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
sorry for interrupting so much,if you still find answer for your question I will tell you as far as I know/
There are two parts 1 is container other is bean.
Home interface allows you to interact with container where as remote interface allow u to invoke business methods on beans.Since there are 2 components to deal with there are 2 interfaces as well
Thansk
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic