I am reading some ejb 2.0 text and I have read quite many such document so far, but still get confused why would we need both EJBLocalObject and EJBLocalHome interfaces for each bean.
For instance, I have a bean:
public abstract class Students implements EntityBean {
}
Then I definitely have
public interface StudentsLocal extends EJBLocalObject {
}
And
public interface StudentsLocalHome extends EJBLocalHome {
}
I know the role of each interface but still wondering what would happen if we did not have EJBLocalHome interface or something like that? Or otherwise?
What does the client do in order to use a Local EJB? You go to the home and ask it for an instance. Without the home how are you proposing to get an instance?
There are also methods such as remove() which are on the Home not on the instance.
However, unless you are faced with maintaining legacy code you really don’t want to do any of this – use EJB 3 and JPA: much much easier.