• Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb-ref Sense & Practice

 
Alexei Vinogradov
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did not quite get it.
Example:
as Bean Provider I make use of the entity bean from my session bean.
i am looking it up with ctx.lookup("java:comp/env/ejb/Account");
and defining it in DD as <ejb-local-ref> ...ejb/Account..
Why am I doing so? It works fine if I just use of
ctx.lookup("ejb/Account"); along with deploying my Entity in
JNDI "ejb/Account" with vendor specific DD-XML.
I cant do without that latter step anyway, can I?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The rationale for using env-entries instead of hardcoding the JNDI names into your Java code is... Oops. I slipped it out already
If your code refers to resources (including other EJBs) by a logical name, you don't have to worry about your chosen JNDI name being unavailable for some reason when you try to deploy your application.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!