title: How can I use an EJB in a EntityListener?
body: <p>I'm designing my database and I reached the situation that an Entity itself requires to access database.</p>
  
  <p>I read <a href="http://www.adam-bien.com/roller/abien/entry/why_sometimes_the_entitymanager_in" rel="nofollow">Why sometimes a reference to an EntityManager inside JPA entities is needed</a>.</p>
  
  <p>And I'm curious about the possibility of accessing an EJB in EntityListener.</p>
  
  <pre><code>public class MyEntityListener {
  
      @PrePersist
      private void onPrePersist(final Object object) {
          // find an EJB
          // and set those required values
          // which each resides in a specific table.
      }
  }
  </code></pre>
  
  <p>Is this possible or (or and) preferred?</p>