GAE Objectify改变嵌入式类的模式

时间:2013-10-08 15:01:26

标签: java google-app-engine objectify

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

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

我有一个实体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从何处引入其模式?

由于

2 个答案:

答案 0 :(得分:0)

GAE只是向您显示数据存储区中的内容,没有我知道的缓存或架构。你在哪里看它?您应该使用视图数据页面:
https://appengine.google.com/datastore/explorer?&app_id= [PROJECT_ID]

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

答案 1 :(得分:0)

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

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

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

相关问题