public abstract class RoomDatabase
extends Object


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:


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. 


protected SupportSQLiteDatabase mDatabase

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

Public constructors


Creates a RoomDatabase.

Public methods

void beginTransaction()

This method is deprecated. Use runInTransaction(Runnable)

abstract void clearAllTables()