How can we deal with getEJBHome () and getEJBObject () in EJBContext interface? I mean how can we cast the general EJBHome and EJBOjbect to the application specific EJB home reference and EJB object reference.
No need to perform type-narrowing of the object received from EJBContext. The following is sufficient enough:
That is what the spec says in regards to SessionContext (same is applicable to EntityContext)
The container must implement the SessionContext.getEJBObject() method such that the bean instance can use the Java language cast to convert the returned value to the session bean�s remote interface type. Specifically, the bean instance does not have to use the PortableRemoteObject. narrow(...) method for the type conversion.
Hope it helps
Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
They weren't very bright, but they were very, very big. Ad contrast: