• Post Reply Bookmark Topic Watch Topic
  • New Topic

Context.lookup()

 
Cheers Prasad
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For EJB 1.0
To get EJB Object we use JNDI lookup
EJBHome = (EJBHome) contextLookp("EJBBean");
After using EJBHome object
1.Can I store the EJBHome object in a static variable of class(may be facade class) for future use thus avoiding lookup.
2. As i have stored in the static varible ,if I delete entry in the JNDI service,will i be able use EJBHome object stored in the variable.
 
anil bisht
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi..
1) yes you can certainly do this. In fact its recommended as JNDI lookup is costly.
for more information
http://www.precisejava.com/javaperf/j2ee/Patterns.htm#Patterns102
2) i too am not sure for this. May be someone here could help us ???
Regards
Anil
 
Cheers Prasad
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anil, I will go thru the link.
To the query no 2,My understanding is that for JNDI lookup,EJB container returns remote stub which is proxy for the Home object to the client.
If I retain the stub (which delegates the request to the skeleton )and use it for future unless the location of EJB object in the server is changed.
Is my Understanding is right that JNDI services is not required once i get the home object.If it is true then even if i delete corresponding entry in JNDI services,my ejb object can be used.
Regards,
Prasad
 
anil bisht
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I too think the same.
As we already have the home interface and bean is not going to do the lookup again.
So even if the jndi-binding is removed it should work.
regards
Anil
 
Cheers Prasad
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Anil, Let me try it thru example.
Need Information
I am working in VAJ(Visual Age Environment).In VAJ all ejb objects when u create are automatically getting registered in JNDI services(Persistence server).I want to know how to get list of objects registered in persistence server.Is there any way i can go remove the registered objects from persistence server without removing the object.
Does VAJ put these information in any file?
Regards,
Prasad
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!