title: how to create this query string in java createQuery?
body: <p>I am trying to use Hibernate or native SQL or java to return a list of <code>Product</code> objects, but I can not get the code working, I appreciate if anybody help me, thanks a lot,
      This is the logic:</p>
  
  <pre><code> ...
   ArrayList&lt;Product&gt; prodList = new ArrayList&lt;Product&gt;();
  EntityManager entityManager = this.entityManager;
  try 
  {
  
    //the logic of following query is: select all records from prodTable table where productDate is
  //passed 2 months than today's date(something list today's day minus productDate is 2 months), 
  //and then the records are not existed in prodCategory table by the key of ProductID and 
  //productCategory combination. So the prodList is the combination of the above two conditions. 
  //something like this:
  
   String queryString = "select p from prodTable p where (today - p.ProductDate) greaterThan 2  
  months AND p is not in (select c from prodCategory c where c.ProductID = p.ProductID and 
  c.category = '09' ) //need help of this line of query.
  
   prodList = entityManager.createQuery(queryString).getResultList();
   return prodList;
  } catch (Exception e) {
  
  throw e;
  </code></pre>
  
  <p>}
  ...</p>