title: looking up entity manager in EJB Helper classes
body: <p>I am trying to inject entity manager in some helper class, I can pass it to the helper from the session bean, but the problem is I need to use the entity manager in the static init block of the helper class (some thing like):</p>
  
  <pre><code>class MySessionBeanHelperClass
  {
   // staff here...
  
  
      static
   {
    SomeClass s = new SomeClass(entityManager);
   }
  }
  </code></pre>
  
  <p>So, I think the only way is to lookup the entity manager instead of injecting it. and also using the passed SessionContent will not work here. (is it????) (this is the first question)</p>
  
  <p>The second question is:
  If I used the ordinary way to lookup a resource (in this case the entity manager)  (something like the following:)</p>
  
  <pre><code>Context ic = new InitialContext(); 
  em = (EntityManager) ic.lookup("java:comp/env/persistence/em"); 
  </code></pre>
  
  <p>Is this will convert all transactions used by this entity manager to Bean-managed transaction??</p>
  
  <p>Thanks!</p>