【发布时间】:2016-01-11 21:57:26
【问题描述】:
我无法理解从 JDO 到 Objectify 的升级过程。
所以我有这门课:
@PersistenceCapable
public class AppUser {
/**
* key from userID
*/
@PrimaryKey
@Persistent
private Key key;
//...
}
我将其升级为:
@Entity
public class AppUser {
/**
* key from userID
*/
@Index Key key;
@Id Long id;
// ...
}
在更改之前,我能够使用以下方法检索实体:
Key _key = KeyFactory.createKey(AppUser.class.getSimpleName(), user.getUserId());
PersistenceManager pm = PMF.get().getPersistenceManager();
AppUser appUser = pm.getObjectById(AppUser.class, _key);
其中user 对象是 AppEngine 的用户对象,由 Google 帐户引用。
如何查询给定用户的实体?当我尝试使用 filterKey 时,结果为空对象。
提前致谢。
【问题讨论】:
标签: google-app-engine google-cloud-datastore objectify