Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ejb-ref Sense & Practice  RSS feed

 
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!