This week's book giveaway is in the Cloud/Virtualization forum. We're giving away four copies of Mastering Corda: Blockchain for Java Developers and have Jamiel Sheikh on-line! See this thread for details.
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)
"I know this defies the law of gravity... but I never studied law." -B. Bunny Defiant tiny ad: