|1600 PMP mock questions||1400 CAPM mock questions||800 SCJP 6 mock questions||600 OCAJP 7 mock questions||590 OCPJP 7 mock questions||556 SCWCD 5 mock questions||500 OCEJWCD 6 mock questions||pdfDownload (java,struts, hibernet etc)|
EJB interview questions
!!! EJB interview questions !!!
How can I call one EJB from inside of another EJB?
In case of Remote :
EJBs can be clients of other EJBs. It just works. Really. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference.
For Example : Context ctx = new InitialContext();
//get Home interface of bean
EmpHome lhome = (EmpHome ) javax.rmi.PortableRemoteObject.narrow(ctx.lookup("java:comp/env/LocalEmp"), EmpHome .class);
//get remote interface
Emplbean = lhome.create();
//now you can call bussiness method on remote interface like
Incase of Local : but we no longer have to worry about the PortableRemoteObject, as the bean is no longer remote
Context ctx = new InitialContext();
Object o = ctx.lookup("java:comp/env/LocalEmp");
EmpHome empHome = (EmpHome)o;
Reviews and Comments
PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc
Copyright © www.techfaq360.com 2016