• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Can we lookup(access) the bean directly?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can we directly look up the bean, i mean instead of giving lookup of the datasource?
 
Ranch Hand
Posts: 8946
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by Datasource?
You will have to lookup the bean using Context API.
 
Sachin Lewis
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I mean instead of using Properties,IntialContextFactory... and so on, how to do it with EJB Refrence ?

Example : (Instead of the below code, how to lookup the bean directly using EJB Refrence)
Properties properties = new Properties();
properties.put("java.naming.factory.initial", "com.ibm.websphere.naming.WsnInitialContextFactory");
properties.put("java.naming.provider.url", "iiop://.....");
InitialContext initialcontext = new InitialContext(properties);
CartHome carthome = (CartHome)initialcontext.lookup("cartjndi");
Cart cart = carthome.create();

Cheers,
Sachin
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The answer is no. That would defeat the purpose of EJB's by not allowing their lifecycle to be managed.
Kyle
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's a one-page tutorial for ejb-ref's.
 
Sachin Lewis
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You all. The replies helped me.
Cheers,

Sachin Lewis
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic