How do I extract properties from Entities in Google App Engine Datastore using Java -


i using google app engine , trying query / pull data datastores. have followed 20 different tutorials without luck.

here picture of datastore , respective sample data have stored in there:

enter image description here

here of code have pull data:

//to obtain keys final datastoreservice dss=datastoreservicefactory.getdatastoreservice(); final query query=new query("coupon"); list<key> keys = new arraylist<key>();  //put keys list iteration (final entity entity : dss.prepare(query).asiterable(fetchoptions.builder.withlimit(100000))) {     keys.add(entity.getkey()); }  try {     (int = 0; < keys.size(); i++){         entity myentity = new entity("coupon", keys.get(i));          system.out.println("size of keys array = " + keys.size());          string description = (string) myentity.getproperty("desc");          string enddate = (string) myentity.getproperty("enddate");          system.out.println("description = " + description);         system.out.println("end date: " + enddate);          //map here empty...         map<string, object> test = myentity.getproperties();          system.out.println("map size = " + test.size());             } } catch (exception e){     e.printstacktrace(); }      **ouput:**      size of keys array = 2     description = null     end date = null     map size = 0 

i have no clue why description , end date null. pulling in right entity size shows 2, matches picture shown. also, when print keys out, matches

(something this: keys.get(i).tostring(); -- entity [!global:coupon(123)/coupon(no-id-yet)]: . or: key string = !global:coupon(5730827476402176)

i have followed documentation (here) , examples (here) best of ability cannot seem figure out. have recommendations or experience in how obtain properties entities once have them without them returning null?

i have gone through following stackoverflow questions without success please not close simple duplicate question marker on it: 1) how child entities in google app engine (low-level api) 2) storing hierarchical data in google app engine datastore? 3) how use list properties in google app engine datastore in java? 4) mass updates in google app engine datastore 5) checking if entity exists in google app engine datastore. .

have tried this?

//put keys list iteration (final entity entity : dss.prepare(query).asiterable   (fetchoptions.builder.withlimit(100000))) {   string description = (string) entity.getproperty("desc");      string enddate = (string) entity.getproperty("enddate");      system.out.println("description = " + description);     system.out.println("end date: " + enddate); } 

in example, creating entity , expected properties empty


Comments

Popular posts from this blog

How to run C# code using mono without Xamarin in Android? -

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -