hello i am using google app engine and using its database i am trying to retrive the data and make a query and only search for the dates or times i want. so if i want all the input dates off September 09, then it will give me the list of all the september dates.
PersistenceManager pm = PMF.get().getPersistenceManager();
List rules = null;
try {
String query = "SELECT FROM "+
TestRule.class.getName()+
" where"+
" days > 31";
System.out.println("query = "+query);
Query q = pm.newQuery(query);
q.setFilter("curDate < endDate");
q.declareParameters("long curDate");
Date curDate = new Date();
rules = (List) q.execute(curDate.getTime());
resp.setContentType("text/html; charset=UTF-8");
PrintWriter out = resp.getWriter();
if(rules != null) {
out.print("<p> Query result size = "+rules.size()+"</p>");
} else {
out.print("<p> Query returned null </p>");
}
} finally {
pm.close();
}
}
The Test rule class has the Database data and has getters and setters. Would anyone know how to do this if there are other ways than that would be great too. Thank you all