android - 我在 android、RoomDatabase 中有一些问题。初级水平
问题描述
我从https://codelabs.developers.google.com/codelabs/android-room-with-a-view-kotlin/?fbclid=IwAR2JnEpU-U4oZ28qfapYCxhivfxGFb0yfoaXUKdrHxAInNDfCi4bmz6044M#0构建 myRoomDatabase 应用程序
现在,我想在我的应用程序中有两个表。一个表名是“word_table”,第二个表名是“word_save_time”。但我没有任何解决方案,这将帮助我在我的应用程序中添加第二个表名。谁能给我一条路,可以解决我的问题?
解决方案
您需要创建另一个带有Entity
注释的类。所以它看起来像:
@Entity(tableName = "word_save_time")
class SaveTime(){}
从您提供的链接:
Each @Entity class represents a SQLite table. Annotate your class declaration to indicate that it's an entity. You can specify the name of the table if you want it to be different from the name of the class. This names the table "word_table".
推荐阅读
- reactjs - 如何使用 RecoilJS 构建深度嵌套状态树?
- node.js - 如何为 Function APP 生成 Azure Swagger UI
- python - 拆分并仅保留存储在 python 数据框列中的英文文本
- reactjs - 无法使用 webapck 加载图像,反应
- python - 熊猫的标题和skirows差异不清楚
- google-apps-script - 将多个 IF OR 语句分组
- python - 如何淡化来自 dynamodb 流的 json
- java - 当我们在android中使用backstack返回上一个片段时,上一个片段正在重新启动
- python - 为数独编写回溯求解器时出错
- c - Netlink:从内核多次接收数据