public abstract class OrmDatabase extends Object
An object relational mapping (ORM) database class corresponds to a relational database. Before using
an ORM database, you need to create a database class that inherits from OrmDatabase
and annotate it with @Database.
OrmObjectSystemCapability.Data#DATA_APPDATAMGR| 构造器 | 说明 |
|---|---|
OrmDatabase() |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
void |
corruptionHandler(File databaseFile) |
Called when a corruption exception occurs when the ORM database is opened.
|
abstract RdbOpenCallback |
getHelper() |
Obtains the
RdbOpenCallback instance for creating a relational database that corresponds to
the current object database. |
abstract int |
getVersion() |
Obtains the database version.
|
public abstract int getVersion()
If you have specified the database version in the @Database annotation, the ORM annotation processor will automatically implement and invoke this method during compilation. In this case, your application does not need to implement and invoke this method.
public abstract RdbOpenCallback getHelper()
RdbOpenCallback instance for creating a relational database that corresponds to
the current object database.
If you have specified the implementation class of OrmMigration in
DatabaseHelper.getOrmContext(java.lang.String, java.lang.String, java.lang.Class<T>, ohos.data.orm.OrmMigration...), the ORM annotation processor will automatically
read the database version and the implementation class, and generate an instance for creating
a relational database that corresponds to the current object database. In this case, your application
does not need to implement and invoke this method.
RdbOpenCallback instance for creating the relational database.OrmMigrationpublic void corruptionHandler(File databaseFile)
databaseFile - the file object representing the database on which corruption
is detected.