Android Room-嵌套嵌入式关系

时间:2019-06-17 14:00:00

标签: java android android-room

我正在尝试创建类 A-With-B ,其中B是 B-With-C 的列表<>。

这可能是重要的信息:类A和类B具有多对多关系,因此它们之间有一个关联表。

所以有我的代码示例:

public class AWithB {
    @Embedded A a;

    @Embedded List<BWithC> b;
}

public class BWithC {
    @Embedded B b;

    @Embedded C c;
}

但这给了我这个错误: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type)

我已经看过@Relation了,但是我不知道它在这种情况下是否真的有用。

0 个答案:

没有答案