I'm trying to implement Google App Engine's default Datastore Statistics API example:
http://code.google.com/appengine/docs/java/datastore/stats.html
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Query;
// ...
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Entity globalStat = datastore.prepare(new Query("__Stat_Total__")).asSingleEntity();
Long totalBytes = (Long) globalStat.getProperty("bytes"); // NullPointerException happens here...
Long totalEntities = (Long) globalStat.getProperty("count");
I get a java.lang.NullPointerException when trying to access the globalStat object properties. I'm testing locally, does this API only work in production or am I missing something?
Thanks