title: JPA @NamedQuery with two tables, possible?
body: <p>I'm having a kind of dummy problem, I need to make a <strong><code>@NamedQuery</code></strong> with a join with other table, some simple thing.</p>
  
  <p>But in all my <code>@NamedQuery</code> I'm only dealing with my mapped Object/Table.</p>
  
  <p>For example in my Object/Table Mapped <em>cars</em>:<br></p>
  
  <pre><code>@NamedQuery(name = Cars.GET_AVAILABLE_CARS, 
      query = "select c.id from Cars c where c.status = (select d.status from CarStatus d where d.color=red)")
  </code></pre>
  
  <p>I'm trying to use: <strong><code>@SecondaryTables</code></strong> but no success for now.</p>
  
  <p>One other thing that is working is give all things from other table as a parameter, but I don't think this will be good in performance.</p>
  
  <p>Like:</p>
  
  <pre><code>@NamedQuery(name = Cars.GET_AVAILABLE_CARS, query = 
       "select c.id from Cars c where c.status = :" + CarStatusParam)
  </code></pre>
  
  <p>Any tips?</p>
  
  <p>Thanks in advance</p>