Prannav Santhosh wrote:Hi thanks for the reply, when we do the a remote lookup ,we get the reference of the JNDI context of the server in which the EJB is deployed and we initialize a hashtable with the url ,.and other information and then we do a lookup using the JNDI name.
But my quesiton here is that if we use @EJB how does the above steps happen ? hope i am clear with my question.
That is the beauty of EJB3 which gives developer flexibility by hiding complex JNDI lookups. The container takes care of JNDI lookup
once it sees @EJB annotation. DI is opposite to JNDI. In the traditional JNDI look up, develoepr has to write code to look for the conainer managed resources. However, in DI the container injects the necessary resources. With this, developer can focus more on implementing business logic rather than writing infrastructure code. You can think DI as a higher level abstraction of JNDI.
Hope this helps.
Sai Surya, SCJP 5.0, SCWCD 5.0, IBM 833 834
http://sai-surya-talk.blogspot.com, I believe in Murphy's law.