title: NamedQuery: IllegalArgumentException (Query not found) after externalizing entities
body: <p>I have successfully used <code>javax.persistence.NamedQuery</code> in combination with JPA2. The named queries are defined at the top of the entity class files, and are used from Stateless EJBs (entity facade).</p>
  
  <p>Now I had to extract the entity class files into a separate Jar file (so we can use them from a Google Web Toolkit project). Obviously I still incude the jar, but now the facade bean does not find the query anymore:</p>
  
  <pre><code>java.lang.IllegalArgumentException: NamedQuery of name: Store.findByExternalId not found.
      at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getDatabaseQueryInternal(EJBQueryImpl.java:576)
      at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:1004)
      at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createNamedQuery(EntityManagerWrapper.java:533)
      at com.skalio.bonusapp.server.StoreFacade.getByExternalId(StoreFacade.java:43)
      ...
  </code></pre>
  
  <p>What is the problem here? Can I not define NamedQueries in an external Jar?</p>
  
  <p>I just found this <a href="http://jdevelopment.nl/put-named-queries-jpa/">link</a>, suggesting to put the NamedQueries in XML files, not as annotations in the entity files. This could be an idea to solve my problem, but doesn't answer my question... ;)</p>