【问题标题】:Google App Engine cloud endpoints - inconsistence after updating an EntityGoogle App Engine 云端点 - 更新实体后不一致
【发布时间】:2013-08-10 10:38:20
【问题描述】:

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

最初我部署了具有以下实体字段的第一个版本:

  @Entity
public class Tweet {

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

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

@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;

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

我哪里错了?

【问题讨论】:

    标签: google-app-engine google-cloud-endpoints


    【解决方案1】:

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

    @PersistenceCapable(detachable="true")
    public class Test implements Serializable {
    
      @PrimaryKey
      @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
      private String id;
      ...
      @Persistent
      private String newAttribute;
    }
    

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

    【讨论】:

      【解决方案2】:

      这是一个应用引擎问题。谷歌人应该尽快修复它:

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

      【讨论】:

        猜你喜欢
        • 2016-02-15
        • 2014-03-20
        • 2014-11-10
        • 2011-04-20
        • 2014-11-13
        • 2012-08-06
        • 2018-06-24
        • 1970-01-01
        • 2018-12-31
        相关资源
        最近更新 更多