Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在GreenDao中实现表继承_Android_Android Sqlite_Greendao - Fatal编程技术网

Android 如何在GreenDao中实现表继承

Android 如何在GreenDao中实现表继承,android,android-sqlite,greendao,Android,Android Sqlite,Greendao,我一直在尝试创建一个数据库,其中所有表都继承某个元素,以便有可能拥有元数据 在这一行的所有表声明中,我在模型生成器中添加了以下内容: public Entity addSuperEntity(Schema schema) { Entity superEntity = schema.addEntity("superEntity"); superEntity.addIdProperty().primaryKey(); // SET RELATIONSHIP 1:m TO

我一直在尝试创建一个数据库,其中所有表都继承某个元素,以便有可能拥有元数据

在这一行的所有表声明中,我在模型生成器中添加了以下内容:

public Entity addSuperEntity(Schema schema) {
     Entity superEntity = schema.addEntity("superEntity");
     superEntity.addIdProperty().primaryKey();
     // SET RELATIONSHIP 1:m TO META DATA
}

public Entity addTable(Schema schema) {
    Entity mEntity = schema.addEntity("MyEntity");
    mEntity.setSuper("superEntity");
    mEntity.addIdProperty().PrimaryKey();
    // REST OF FIELDS
}
问题是:

现在,在我为我的Android项目生成了这个之后,我如何才能确保这仍然发生在现实生活中?我现在需要改变什么吗


官方文档没有任何关于继承的内容。

使用setSuperclass(String)的非实体超类支持继承。另一种方法是使用implementsInterface(字符串)实现接口

我在关于继承和接口的新章节中更新了官方文档中的一些细节: