• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Entity Beans Remote or Local Interfaces

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am currently studying for the SCBCD exam with Headfirst EJB and have gotten a little confused with Entity Beans and their interfaces...

Although I'm sure that there's much I still don't understand, I have started putting together a small project to make sure that I understand the aspects of creating Entity Beans and noticed in the ejb-jar.xml that for an entity bean, the interfaces are defined in tags labelled <local-home> and <local>.

This got me wondering whether I should be creating a local component and home interface for my bean or a remote one. Another book I was reading suggested that as Entity Beans are most likely to be called by Session Beans that are probably going to be local to the Entity Bean, then you should use Local interfaces rather than remote (as this would be more efficient).

Is there any guidelines/recommendations on this, as it does seem a bit odd that the DD has these tags for both Remote and Local interfaces.

Can anyone offer any insight?

Thanks,




Mike
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The difference berween Local and Remote is the same between pass by reference and pass by value.So a local tag was provided which says that the access client and the accessed Bean (through the EJBObject ) are running in a same jvm or in other words in same process.Which makes it faster.

I would say if u r writing your first example.Try hands on Remote. Since Local you will understand on the path.Don,t worry about it.
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, Entity bean should not be explosed as a remote view, as it contains real data from DB. That's why some of the books suggest that, Entity bean should only provide local interface, and being invoked NOT by the client directly, instead, via a SessionBean.

Nick
 
V Sharma
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Agrees with you.Infact to sort out the problem Specs has said that local interface is must for defining relationship.But if you right the first program I would say Remote gives more clear picture to the programmer what stuff is there in ....
 
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Under what situation, entity bean is better to have a remote interface? If it allows to have only local interface, spec should have removed the option of exposing the bean remotedly.

Could the bean be local in term of cluster?
 
Joe Nguyen
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About the relationship, local interface allows other entity beans to have relationship with this bean. A entity bean with no local interface can have relationship with other entity beans as long as these beans have local interfaces, but the reverse is not true.
 
Bring me the box labeled "thinking cap" ... and then read this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!