title: @EJB annotation vs JNDI lookup + transaction
body: <p>Acording to another post [1] there's no difference between invoking a session EJB via JNDI lookup and using the @EJB annotation. However, in the following scenario:</p>
  
  <p>1.- call session EJB1(JDBC inserts here)
  2.- From EJB1, call session EJB2 (more inserts here)
  3.- Rollback the transaction (from EJB1)</p>
  
  <p>If I use the @EJB annotation it works fine, but with the JNDI lookup it doesn´t, the transaction in the second EJB is a new one and the rollback doesn´t happen. All this with CMT.</p>
  
  <p>I'm deploying all this stuff in a Geronimo/ibmwasce-2.1.1.6.</p>
  
  <p>¿Do I need to pass the transaction from one EJB to another explicitly? I thought it was the continer job. ¿Any clues?</p>
  
  <p>[1] <a href="https://stackoverflow.com/questions/12681436/ejb-annotation-vs-jndi-lookup">@EJB annotation vs JNDI lookup</a></p>
  
  <p>Update:</p>
  
  <p>Code via annotation:</p>
  
  <pre><code>@EJB
  private CodAppEjb codAppejbAnotacion; 
  </code></pre>
  
  <p>Code via jndi:</p>
  
  <pre><code>CodAppEjb codAppejb;
  InitialContext ctx;
  Properties properties= new Properties();
  properties.setProperty("java.naming.provider.url", "ejbd://127.0.0.1:4201");
  properties.setProperty("java.naming.factory.initial", "org.apache.openejb.client.RemoteInitialContextFactory");
  ctx = new InitialContext(properties);
  codAppejb= (CodAppEjb) ctx.lookup("CodAppEjbBeanRemote");
  </code></pre>
  
  <p>The transaction code is just the same.</p>