Reputation: 49
Date today = new Date();
Query query5 = pm.newQuery(TMS.class);
query5.setFilter("start_date < date");
query5.setFilter("end_date > date");
query5.setFilter("emp_Id == id");
query5.declareParameters("java.util.Date date,String id");
List<TMS> result1 = (List<TMS>)query5.execute(today,session.getAttribute("emp_Id").toString());
Query gives all the result and the condition is not working.. It is not giving any error also. can any body give the solution?
Upvotes: 0
Views: 1380
Reputation: 19416
You are querying on multiple properties. You will need to create an index by defining it in your datastore.indexes file. Single property queries are only enabled by default.
Upvotes: 0
Reputation: 156
I don't know for sure, but maybe it happens because there are some restrictions on queries.
On GAE you can't use inequality filters on more than one property. You use operator LESS_THAN on "start_date" property and operator GREATER_THAN on "end_date" property. Maybe that's the problem.
Check this out: http://code.google.com/appengine/docs/java/datastore/queries.html#Restrictions_on_Queries
Upvotes: 1