Google App Engine云端点 - 更新实体后的不一致性

时间:2022-08-22 11:20:32

A few days ago I've started developing a Backend for Mobile Applications using Google App Engine and Google Cloud Endpoints.

几天前,我开始使用Google App Engine和Google Cloud Endpoints开发移动应用后端。

Initially I deployed a first version with the following entity fields:

最初我部署了第一个版本,其中包含以下实体字段:

  @Entity
public class Tweet {

  @Id
  private String id;
  private String user;
  private String text;
  private String date;
  private int count;
  private String linkTweet;

After a while, I added other fields:

过了一会儿,我添加了其他字段:

@Entity
public class Tweet {

  @Id
  private String id;
  private String user;
  private String text;
  private String date;
  private int count;
  private String linkTweet;
  private String imageHttp;
  private String imageHttps;
  private String userId;

In the datastore I see changes, but when I go to https://myappid.appspot.com/_ah/api/tweetendpoint/v1/tweet I see only the old fields, there aren't the imageHttp imageHttps userId fields :(

在数据存储区中,我看到了更改,但是当我转到https://myappid.appspot.com/_ah/api/tweetendpoint/v1/tweet时,我只看到旧字段,没有imageHttp imageHttps userId字段:(

Where I'm wrong?

哪里我错了?

2 个解决方案

#1


0  

I did the same change and it works fine. The only difference between my code and yours is that I am using JDO and have the tag (@Persistence) before each attribute.

我做了同样的改变,它工作正常。我和我的代码之间的唯一区别是我使用的是JDO并且在每个属性之前都有标记(@Persistence)。

@PersistenceCapable(detachable="true")
public class Test implements Serializable {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private String id;
  ...
  @Persistent
  private String newAttribute;
}

NOTE: if you don't have data in new fields, you will not see them in response.

注意:如果您没有新字段中的数据,则不会看到它们作为响应。

#2


0  

This is an appengine issue. Google guys should fix it soon:

这是一个引人注目的问题。 Google员工应该尽快修复它:

https://code.google.com/p/googleappengine/issues/detail?id=9686

https://code.google.com/p/googleappengine/issues/detail?id=9686

#1


0  

I did the same change and it works fine. The only difference between my code and yours is that I am using JDO and have the tag (@Persistence) before each attribute.

我做了同样的改变,它工作正常。我和我的代码之间的唯一区别是我使用的是JDO并且在每个属性之前都有标记(@Persistence)。

@PersistenceCapable(detachable="true")
public class Test implements Serializable {

  @PrimaryKey
  @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
  private String id;
  ...
  @Persistent
  private String newAttribute;
}

NOTE: if you don't have data in new fields, you will not see them in response.

注意:如果您没有新字段中的数据,则不会看到它们作为响应。

#2


0  

This is an appengine issue. Google guys should fix it soon:

这是一个引人注目的问题。 Google员工应该尽快修复它:

https://code.google.com/p/googleappengine/issues/detail?id=9686

https://code.google.com/p/googleappengine/issues/detail?id=9686