applications_app_samples/data/ORM
zhangxinlogo 84958c7595 add readme and modify screenshots
Signed-off-by: zhangxinlogo <zhangxin360@huawei.com>
2021-07-13 12:58:39 +08:00
..
entry add readme and modify screenshots 2021-07-13 12:58:39 +08:00
screenshots/device add readme and modify screenshots 2021-07-13 12:58:39 +08:00
build.gradle add readme and modify screenshots 2021-07-13 12:58:39 +08:00
README_zh.md add readme and modify screenshots 2021-07-13 12:58:39 +08:00
README.md add readme and modify screenshots 2021-07-13 12:58:39 +08:00
settings.gradle add readme and modify screenshots 2021-07-13 12:58:39 +08:00

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.

  1. An ORM database is annotated by @Database and inherited from OrmDatabase.
  2. A table in the ORM database is annotated by @Entity and inherited from OrmObject.
  3. OrmContext is used to upgrade, back up, delete and restore the database, add, delete, modify, and query tables, and listen for data changes.

Usage

  1. 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.
  2. Click Upgrade to upgrade the database from version 1 to version 2 and then to version 3.
  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.