title: EJB Injection using deployment descriptor
body: <p>I am a little bit confused by the variety of the ways to inject an <code>EJB</code> and therefore I would be grateful to anyone has an explanation to one or more of the following themes:</p>
  
  <p>1) What is the difference when injecting an <code>EJB</code> through annotations and specifying <code>"name"</code> or <code>"lookup"</code>. Example:</p>
  
  <pre><code>@EJB(name="ejb/mybean") // or @EJB(lookup="ejb/mybean")
  @Stateless
  public class MyStateless implements BusinessLocalInterface{
  
  ...
  } 
  </code></pre>
  
  <p>I think <code>"name"</code> serves the lookup under <code>"java:comp/env/..."</code>, but what is to be done differntly using <code>"lookup"</code>?</p>
  
  <p>2) Doing the injection in <code>ejb-jar.xml</code> instead, i.e. :</p>
  
  <pre><code>&lt;ejb-local-ref&gt;
          &lt;ejb-ref-name&gt;ejb/MyBean&lt;/ejb-ref-name&gt;
          &lt;local&gt;pl.LocalInterface&lt;/local&gt;
          &lt;ejb-link&gt;BeanClass&lt;/ejb-link&gt;
          &lt;injection-target&gt;
              &lt;injection-target-class&gt;pl.MyClass&lt;/injection-target-class&gt;
              &lt;injection-target-name&gt;targetName&lt;/injection-target-name&gt;
          &lt;/injection-target&gt;
      &lt;/ejb-local-ref&gt;
  </code></pre>
  
  <p>What is the diferrence between <code>&lt;ejb-local-ref&gt;</code> and <code>&lt;ejb-ref&gt;</code>?</p>
  
  <p>What is the <code>injection-target</code> elements, what can one achive with them and when are they to be used?</p>