• 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
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

reference injection

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I earlier version of ejb if we want to get reference of another ejb reference then we had to do the look up and get the home object through which he had to get the bean but in new version of ejb do we still have to do the look up or @ejb private some variable will inject the reference?

Thanks in advance
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Example:

@Stateless
@Local({One.class})
class OneBean implements One{
public void doSmth(){...}
}

@Stateless
@Local({Two.class})
class TwoBean implements Two{

@EJB
private One oneBeanInstance;
public void doSmth2(){...}
}

You have to refer to OneBean class through business interface.
Container will inject implementation of that interface after bean creation and before every invocation of business method.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic