【问题标题】:GAE Objectify changing schema of embedded classGAE Objectify 改变嵌入式类的模式
【发布时间】:2013-10-08 15:01:26
【问题描述】:

我是谷歌应用引擎的新手,我发现它存在一些问题。

其中一个与更改嵌入式类的架构有关:

我有一个实体Exam如下:

@Entity public class Exam{
    @Id public Long id;
    ...
    public List<PairingPopulationSet> pairing_population_data = new ArrayList<PairingPopulationSet>();
}

PairingPopulationSet 已更改为:

@Embed public class PairingPopulationSet {
    public Long examiner_id;
    public String examiner_name;
    public Integer percentage;
}

@Embed public class PairingPopulationSet {
    public Integer paper;
    public Long examiner_1_id;
    public String examiner_1_name;
    public Long examiner_2_id;
    public String examiner_2_name;
    public Integer percentage;
}

当我在后端查看数据存储时,我只看到值 percentage,以及 examiner_nameexaminer_id 的列(不再存在的字段)。

是否有需要更新的缓存?我已经尝试擦除整个数据库,执行干净的构建然后重新运行,但是问题仍然存在,GAE 从哪里提取其架构?

谢谢

【问题讨论】:

    标签: java google-app-engine objectify


    【解决方案1】:

    GAE 只是向您展示了数据存储中的内容,没有我知道的缓存或架构。你在哪里看?您应该在以下位置使用查看数据页面:
    https://appengine.google.com/datastore/explorer?&app_id=[project_id]

    如果即使在您重新创建所有数据后仍显示旧字段,那么我建议您可能仍在运行旧版本的应用程序。

    【讨论】:

      【解决方案2】:

      阅读 Objectify 文档中关于迁移模式的这一部分:

      https://code.google.com/p/objectify-appengine/wiki/SchemaMigration

      更改代码的架构不会更改数据存储区中的数据。您必须加载并保存每条记录才能实际进行任何更改。

      【讨论】:

      • 我指的是新数据的列 - 即我创建了一个新考试,它设置了旧值(代码中从未引用过的值)结果证明问题是通过构建、部署来解决的,在 netbeans 中运行(失败),然后从终端运行。很奇怪,如果我从netbeans中省略run,就看不到最新版本了。
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多