I don't know if this is a problem that is specific to Google App Engine for Java, but if the value set as the keywords
parameter is a null String, then nothing is returned from the query, even if a minPrice
is set.
How do I change this query to make it return records that meet the minPrice
condition even if the keywords
value is null? Ideally I would somehow use the same query for both conditions without creating separate queries based on a null String condition.
Query qry = entityManager.createQuery("SELECT p FROM Test p
WHERE keywords = :keywords and price >= :minPrice");
qry.setParameter("keywords", keywords);
qry.setParameter("minPrice", Integer.parseInt(minPrice));