有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何在Android房间中使用具有多个实体的单一模型?

我对安卓房间数据库有问题。 我有一个字典数据库,它包含两个表,每个表的每一列都有相同的名称

代码如下:

@Entity(tableName = "eng_dictionary")
public class EnglishDictionary {
    @PrimaryKey
    protected Integer id = null;
    protected @NonNull
    String word = "";
    protected @NonNull
    String translation = "";
    protected @NonNull
    String related_words = "";
}

@Entity(tableName = "krn_dictionary")
public class KoreanDictionary {
    @PrimaryKey
    protected Integer id = null;
    protected @NonNull
    String word = "";
    protected @NonNull
    String translation = "";
    protected @NonNull
    String related_words = "";
}

相同,我可以使用一个模型和多个实体吗


共 (0) 个答案