title: hibernate QuerySyntaxException - Field is not mapped
body: <p>I am getting a QuerySyntaxException trying to run a HQL query against 2 tables:</p>
  
  <pre><code> select p from ProductEntity p join p.categories c, p.productType t where c.name = :category and t.name = :type
  </code></pre>
  
  <p>The exception is:</p>
  
  <pre><code> org.hibernate.hql.internal.ast.QuerySyntaxException: p.productType is not mapped 
  </code></pre>
  
  <p>My entities are set up so I thought everything was mapped:</p>
  
  <pre><code> Product Entity:
  
   @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "PRODUCT_TYPE_ID", nullable = false)
  private ProductTypeEntity productType;
  
  Product Type Entity:
  
  @OneToMany(fetch = FetchType.LAZY, mappedBy = "productType")
  private Set&lt;ProductEntity&gt; products = new HashSet&lt;ProductEntity&gt;(0);
  </code></pre>
  
  <p>I want to select all products with a category of 'x' and a product type of 'y'.</p>
  
  <p>A product has a set of categories and it also has a single type, although a type can apply to many products.</p>
  
  <p>Can anyone see what is wrong with my query?</p>