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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -