【发布时间】:2016-07-31 19:26:42
【问题描述】:
我正在尝试使用带有 objectify 的谷歌应用引擎登录,但由于谷歌用户对象没有足够的信息,我创建了一个看起来像这样的本地实体:
@Cache
@Entity
public abstract class UserData extends RoleUser implements UserDetails {
protected String firstName;
protected String middleName;
protected String lastName;
protected boolean enabled;
protected String phoneNumber;
@Index
protected String email;
@Index
protected String userName;
我有一个像这样的 GoogleUser 的子类:
@Subclass
public class GoogleUser extends UserData {
private String googleUserId;
private String authDomain;
最后,我运行查询是否为特定电子邮件创建了我的自定义实体,如下所示:
public boolean isNewUser(String email){
int count = ofy().load().type(GoogleUser.class).filter("userName =", email).count();
logger.debug("Total accounts for email: |" + email + "| \t Count: " + count);
return count == 0;
}
我遇到的问题是,即使我在本地 appengine 服务器上通过管理员查看数据存储区时看到了实体,查询也会返回 0 个结果。我已经走到了尽头,所以我将不胜感激。
【问题讨论】:
-
你排除了eventual consistency吗?
-
@tx802 是的,我认为这不是复制问题,因为我重新启动了服务器,并且我看到该字段已在管理员中建立索引。我假设一旦它出现在管理员中,它就可以查询了,但我可能错了
标签: java google-app-engine objectify