RoomDatabase

public abstract class RoomDatabase
extends Object

java.lang.Object
   ↳ androidx.room.RoomDatabase


Base class for all Room databases. All classes that are annotated with Database must extend this class.

RoomDatabase provides direct access to the underlying database implementation but you should prefer using Dao classes.

See also:

Summary

Nested classes

class RoomDatabase.Builder<T extends RoomDatabase>

Builder for RoomDatabase. 

class RoomDatabase.Callback

Callback for RoomDatabase

enum RoomDatabase.JournalMode

Journal modes for SQLite database. 

class RoomDatabase.MigrationContainer

A container to hold migrations. 

class RoomDatabase.PrepackagedDatabaseCallback

Callback for RoomDatabase.Builder.createFromAsset(String), RoomDatabase.Builder.createFromFile(File) and RoomDatabase.Builder.createFromInputStream(Callable)

This callback will be invoked after the pre-package DB is copied but before Room had a chance to open it and therefore before the RoomDatabase.Callback methods are invoked. 

interface RoomDatabase.QueryCallback

Callback interface for when SQLite queries are executed. 

Fields

protected SupportSQLiteDatabase mDatabase

This field is deprecated. Will be hidden in the next release.

Public constructors

RoomDatabase()

Creates a RoomDatabase.

Public methods

void beginTransaction()

This method is deprecated. Use runInTransaction(Runnable)

abstract void clearAllTables()

Deletes all rows from all the tables that are registered to this database as Database.entities().

void close()

Closes the database if it is already open.

SupportSQLiteStatement compileStatement(String sql)

Wrapper for