title: IntelliJ IDEA highlights @Entity class names with "Cannot resolve symbol" in JPQL
body: <p>IntelliJ IDEA highlights persistent @Entity class names with "Cannot resolve symbol" in red in JPQL which is distracting and buries real issues. </p>
  
  <p>So, for example, I declare a query in my repository:</p>
  
  <pre><code>private static final String READ_BY_CANDIDATE_KEY = "SELECT cr FROM Entity AS cr left join cr.relationship AS re left join fetch cr.relationship2 WHERE re.candidateKey=:ID";
  </code></pre>
  
  <p>.. and "Entity" is underlined, even though "Entity" is a valid class name, and has the @Entity annotation. When the code actually runs, there are no problems.</p>
  
  <p>I imagine some sort of configuration is required to let the IDE know what classes are valid? How is that configuration done?</p>
  
  <p><strong>Update</strong>: I do have a JPA facet, but it doesn't see the annotated classes. It seems to require a persistence.xml or orm.xml (which my project does not use)</p>