mirror of
https://gitee.com/openharmony/applications_app_samples
synced 2024-11-27 10:40:41 +00:00
84958c7595
Signed-off-by: zhangxinlogo <zhangxin360@huawei.com> |
||
---|---|---|
.. | ||
entry | ||
screenshots/device | ||
build.gradle | ||
README_zh.md | ||
README.md | ||
settings.gradle |
Object Relational Mapping ORM
Database
Introduction
This sample uses annotations and inheritance to create databases and tables, allowing for database upgrade, backup, deletion, and restoration, table adding, deletion, modification, and query, and listening for data changes.
- An ORM database is annotated by @Database and inherited from OrmDatabase.
- A table in the ORM database is annotated by @Entity and inherited from OrmObject.
- OrmContext is used to upgrade, back up, delete and restore the database, add, delete, modify, and query tables, and listen for data changes.
Usage
- Click Insert to insert data, click Update to update data, click Delete to delete data, and click Query to query data and view the query result.
- Click Upgrade to upgrade the database from version 1 to version 2 and then to version 3.
- Click Backup to back up the database, click DeleteDB to delete the database, and click Restore to restore the database.
Constraints
This sample can only be run on standard-system devices.