views:

229

answers:

3

I'm running this query:

SELECT FROM com.Data WHERE entryDate > DATE('2010-3-16')

I get this error:

org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeatureException: Problem with query DATE('2010-3-16')>: Unsupported method while parsing expression: InvokeExpression{[null].DATE(Literal{2010-3-16})}

The same query works when I use it on the admin console. But it does not work for code (java), either locally or when deployed. Any ideas?

A: 

Have you tried using a datetime? Dates, times, and datetimes are all stored internally as datetimes; it's possible the Java SDK doesn't implement this automatic casting for you.

Nick Johnson
A: 

I had the same problem

try :

Query query = pm.newQuery("select from com.Data where entryDate > myDate");
query.declareImports("import java.util.Date");
query.declareParameters("Date myDate");
query.execute(now);
Sebastian
A: 

I suggest storing all your dates as Long and performing the conversion on the static date prior to executing the query.

Stevko