File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Interfaces " Watch "Interfaces " New topic
Author

Interfaces

Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
Hi, ¿could someone explain what way the next code works?


InterfaceName bean =(InterfaceName)context.lookup("JNDI-Name");


In bean, ¿is loaded an interface name or the code which is write in the EJB which correspond the interface name, or another way?

Thanks.
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

The resource at "JNDI-NAME" is fetched from the JNDI and returned as an Object.
It is not an interface it is an Object.

The next step is to cast the resulted Object to the type you're expecting (in this case "InterfaceName").

Does this answer your question?


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Dura Hurtado
Ranch Hand

Joined: Feb 16, 2011
Posts: 120
The resource at "JNDI-NAME" is fetched from the JNDI and returned as an Object.
It is not an interface it is an Object.

The next step is to cast the resulted Object to the type you're expecting (in this case "InterfaceName").

Does this answer your question?


Yes , thanks for your answer.
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

That's great :-)

Good luck!
 
 
subject: Interfaces