检索到的JDO密钥与持久存在的密钥有什么不同?

时间:2016-06-04 07:08:29

标签: java google-app-engine indexing jdo datapersistance

在我的谷歌应用引擎应用程序中,我坚持下面的jdo一段时间,

package com.acti.JDO;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.google.appengine.api.datastore.Key;

@PersistenceCapable
public class Subscription {

@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key ;

public Key getKey() {
    return key;
}

public void setKey(Key key) {
    this.key = key;
}

@Persistent
private String email;

@Persistent
private String clientID;

public String getEmail() {
    return email;
}

public void setEmail(String email) {
    this.email = email;
}

public String getClientID() {
    return clientID;
}

public void setClientID(String clientID) {
    this.clientID = clientID;
}
}

稍后我想将clientID更改为clientId,

@Persistent
private String clientId;

public String getClientId() {
    return clientId;
}

public void setClientID(String clientId) {
    this.clientId = clientId;
}

并相应地进行了更改,并删除了之前的jdo实体,并开始使用新的' clientId'键。虽然我只能在Datastore中看到clientId,但当我检索订阅jdos时,我得到的关键是' ClientID'

我试图获取jdo实体的代码位于

之下
   public ArrayList<Subscription> getSubscriptionJDOs(String    queryParam)
   {
    ArrayList<Subscription> subscriptionJDOList = null;
    PersistenceManager          persistentManager  = null;
    Query                                   query  = null;

    try
    {
        subscriptionJDOList   = new ArrayList<Subscription>();  
        persistentManager     = JdoUtil.get().getPersistenceManager();
        query                 = persistentManager.newQuery(Subscription.class, queryParam);

        subscriptionJDOList.addAll((List<Subscription>) query.execute());
    }
    catch(Exception ex)
    {
        log.info("Subscription Exception while getting the the subscription JDOs ::"+ex.getMessage());
    }

return subscriptionJDOList;
}

但我试图得到的jdos有关键clientID,而不是clientId。我试图杀死app引擎实例并再次尝试。还是没有解决。任何人都知道为什么会这样。

提前致谢!

0 个答案:

没有答案