google app engine - Objectify does not fetch by String ID -



google app engine - Objectify does not fetch by String ID -

i have datastore kind in id field string

ofy().load().type( scores.class ).id( playername ).now();

this fetches null. have confirmed entity given playername exists. not happen kind id long.

code scores class

import com.googlecode.objectify.key; import com.googlecode.objectify.annotation.entity; import com.googlecode.objectify.annotation.id; import com.googlecode.objectify.annotation.parent; @entity public class scores { @parent public key<rankerroot> parentkey; @id public string playername; public int value; }

you need sure giving objectify plenty info build entity's key. so, if entity has ancestor, id/name lone insufficient.

if entity has ancestor, can build key , load entity key, this:

key<scores> scorekey = key.create(parentkey, scores.class, playername); ofy().load().key(scorekey).now();

google-app-engine gae-datastore objectify

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -