• Post Reply Bookmark Topic Watch Topic
  • New Topic

Different interfaces in EJB 3.0

 
Vaibhav Bhardwaj
Greenhorn
Posts: 5
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I just read about interfaces in EJB. What I have read is : There are two interfaces in EJB. The first one is "Home interface" which contains life cycle methods of a bean and upon "create" method invocation , it gives a reference of second interface i.e. "remote interface" which contains business methods. Can you guys please throw some light on other interfaces like local , local home....Actually these things are creating lot of confusion. Please write about all interfaces.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35719
412
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are almost there. Home and Remote are the "original" interfaces to look up and call an EJB. Local Home and Local were added later for when remoting was needed (like when your ejb and caller are in the same server.). They have the same purpose as the remote versions; just without actually being remote.
 
Vaibhav Bhardwaj
Greenhorn
Posts: 5
Hibernate Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So can we say that if I need to call an entity bean from a session bean (now client(session bean) and target bean(entity bean) are in same server i.e. EJBContainer ) then I will have to look up for "LocalHome" interface and from its reference , I should make a call to create() which will give me a reference of "Local" interface (which contains entity beans methods and this interface is implemented by Entity bean).
So "Remote interface" belongs to "Local interface" and "Home interface" belongs to "LocalHome interface".

May be there is performance improvement using LocalHome and Local interface but here also we need to use lookUp mechanism to find LocalHome interface mechanism. Please throw some light on my understanding.
 
Mahendr Shinde
Ranch Hand
Posts: 38
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your Local and Remote interfaces are COMPONENT interfaces. they act like proxies for your beans. Home interfaces are used to create reference to component interfaces. In EJB 3.0, Home interfaces are not required, you just need component interfaces for your Beans.
It would be better if you try some books on EJB 3.0 (EJB 2.x is almost deprecated, so look for books on EJB 3.0 or EJB 3.1)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!