在我的谷歌应用引擎应用程序中,我在下面坚持了一段时间的 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”键持久化 jdo。虽然我只能在 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。我试图杀死应用引擎实例并再次尝试。仍然没有解决。任何人都知道为什么会这样。
提前致谢!