I appreciate your input, Rania. But Cade's book doesn't explicitly state that information as far as I could find. I would appreciate some reliable source explicitly stating which patterns match what in J2EE API. I'm very confused since Whizlabs simulator says one thing and another study guide states something totally different.
I understand your confusion, that true some time when we read from different sources, I get confused me too ... but to go back to your question regarding the EJB and Patterns ....From my knowledge, what�s important to understand is that when they ask which pattern describe best an EJB interface (remote or home ) is to give the main action of that interface and see which pattern is doing that Job(that main action). So for Home Interface you agree that it�s used by the client to create, remove and find an EJB, so just because it�s creating instance of EJB , it�s acts as Factory !!!, now is it Abstract Factory or the Factory Method ??, the point is not which kind from the Factory pattern... for the Exam, you have a hole section for Design Pattern where you have questions on different pattern ( select the most appropriate design Pattern for a Given Scenario, or State the name of the design pattern from given UML Diagram) and where you have to select exactly which design pattern was on the given Scenario... Mark Cade , explain that very well (for EJB and pattern) go read Chapter2 p 16.
Hope this help, and let me know if you still confused, I�ll try to find other good resource where you can get bit more details.
Hi Filip I think Rania is very true as per Marc Cade's book literature and basic fundamentals of we all.
But I just want one more thing that if options comes with both the cases like Decorator and Proxy for the EJBOBject then its better to choose the Proxy (Cade) and same for the EJBHome, I think its truly Factory Method but Cade said its a Factory whether Abstract or Fac. Method that he hasnt specified. So, my call is on Factory Method because it creates only one type of Product that is one type of Bean's Remote/Local object but not other objects which are related to the bean and type family.
Nice question, if we keep aside the answers given by the simulators/literature, the answer is not quite black-and-white.The Container's implementation the EJBHome is an adapter around the bean; the client stub is a Proxy. If one considers that the calls to EJBHome and EJBComponent are intercepted by the container and 'additional functionality of authorization is performed' one could think of it as a decorator.However, I'd say its a proxy because while the decorated object can be accessed directly, the bean cannot.