title: Getting 'Named query not found' with Spring framework
body: <p>I have a Java class (Entity) with a set of named queries. When the Spring tries to inject the related bean, it is not finding one of the queries.</p>
  
  <p>As example:</p>
  
  <pre><code>@NamedQueries({
          @NamedQuery(name = "Query1", query = "..."),
          @NamedQuery(name = "Query2", query = "..."),
          @NamedQuery(name = "Query3", query = "..."),
          @NamedQuery(name = "Query4", query = "..."),
          @NamedQuery(name = "Query5", query = "...")
  })
  </code></pre>
  
  <p>When Spring tries to inject the bean, I´m getting:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean
  with name 'myBean': Injection of resource methods failed;nested exception is
  java.lang.IllegalArgumentException: Named query not found: Query3 at ...
  </code></pre>
  
  <p>I´m sure the queries are correct (all the unit tests for them are passing).</p>
  
  <p>Does anybody know the root cause for it?</p>