1
我有选择基于__key__(唯一标识符)在谷歌的AppEngine【JAVA]
public class QuantityType {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private String type;
}
我想设置一个查询,以获得正确的QuantityType通过它的关键
gql = "select * from QuantityType where __key__='aght52oobW1hIHTWVzc2FnZRiyAQw'";
但它不工作,因为
BadFilterError:BadFilterError:invalid filter:key filter value must be a Key;得到了一个强大的支持。
我也曾尝试使用
gql = "select * from QuantityType where __key__=='" + KeyFactory.stringToKey(qTypeKey)+"'";
,但它不工作..
如何从我的数据存储获得一个特定的对象由它的键?
并且解决方案是 QuantityType q = pm.getObjectById(QuantityType.class,KeyFactory.stringToKey(qTypeKey)); 谢谢 – Stavros 2010-05-24 02:06:19