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.
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.
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.
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 ....
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?
posted 15 years ago
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: