Register now for Android Dev Summit 2019!

androidx.room

Classes

CoroutinesRoom

A helper class for supporting Kotlin Coroutines in Room.

DatabaseConfiguration

Configuration class for a RoomDatabase.

FtsOptions

Available option values that can be used with Fts3 & Fts4.

InvalidationTracker

InvalidationTracker keeps a list of tables modified by queries and notifies its callbacks about these tables.

Room

Utility class for Room.

RoomDatabase

Base class for all Room databases.

RoomWarnings

The list of warnings that are produced by Room.

RxRoom

Helper class to add RxJava2 support to Room.

Exceptions

EmptyResultSetException

Thrown by Room when the query needs to return a result (e.g. in a Single<T> query) but the returned result set from the database is empty.

Annotations

ColumnInfo

Allows specific customization about the column associated with this field.

Dao

Marks the class as a Data Access Object.

Database

Marks a class as a RoomDatabase.

DatabaseView

Marks a class as an SQLite view.

Delete

Marks a method in a Dao annotated class as a delete method.

Embedded

Marks a field of an Entity or POJO to allow nested fields (i.e. fields of the annotated field's class) to be referenced directly in the SQL queries.

Entity

Marks a class as an entity.

ForeignKey

Declares a foreign key on another Entity.

Fts3

Marks an Entity annotated class as a FTS3 entity.

Fts4

Marks an Entity annotated class as a FTS4 entity.

Ignore

Ignores the marked element from Room's processing logic.

Index

Declares an index on an Entity.

Insert

Marks a method in a Dao annotated class as an insert method.

Junction

Declares a junction to be used for joining a relationship.

OnConflictStrategy

Set of conflict handling strategies for various Dao methods.

PrimaryKey

Marks a field in an Entity as the primary key.

Query

Marks a method in a Dao annotated class as a query method.

RawQuery

Marks a method in a Dao annotated class as a raw query method where you can pass the query as a SupportSQLiteQuery.

Relation

A convenience annotation which can be used in a POJO to automatically fetch relation entities.

SkipQueryVerification

Skips database verification for the annotated element.

Transaction

Marks a method in a Dao class as a transaction method.

TypeConverter

Marks a method as a type converter.

TypeConverters

Specifies additional type converters that Room can use.

Update

Marks a method in a Dao annotated class as an update method.

Extension functions summary

For RoomDatabase
suspend R
RoomDatabase.withTransaction(block: suspend () -> R)

Calls the specified suspending block in a database transaction.

Extension functions

withTransaction

suspend fun <R> RoomDatabase.withTransaction(block: suspend () -> R): R

Calls the specified suspending block in a database transaction. The transaction will be marked as successful unless an exception is thrown in the suspending block or the coroutine is cancelled.

Room will only perform at most one transaction at a time, additional transactions are queued and executed on a first come, first serve order.

Performing blocking database operations is not permitted in a coroutine scope other than the one received by the suspending block. It is recommended that all Dao function invoked within the block be suspending functions.

The dispatcher used to execute the given block will utilize threads from Room's query executor.