# Room

Artifact: [androidx.room3:room3-runtime](https://developer.android.com/jetpack/androidx/releases/room3) [View Source](https://cs.android.com/search?q=file:androidx/room3/Room.+class:androidx.room3.Room) Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  object Room
  ```

*** ** * ** ***

Entry point for building and initializing a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`.

## Summary

| ### Public functions |
|---|---|---|
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(kotlin.String,kotlin.Function0)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, noinline factory: () -> T)` Creates a RoomDatabase.Builder for a persistent database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(kotlin.String,kotlin.Function0)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(kotlin.String,kotlin.Function0)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. | N |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(kotlin.String,kotlin.Function0)(name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. | JS |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(android.content.Context,java.lang.Class,kotlin.String)( context: https://developer.android.com/reference/android/content/Context.html, klass: https://developer.android.com/reference/java/lang/Class.html<T>, name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html? )` Creates a RoomDatabase.Builder for a persistent database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(android.content.Context,kotlin.String,kotlin.Function0)( context: https://developer.android.com/reference/android/content/Context.html, name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, noinline factory: () -> T )` Creates a RoomDatabase.Builder for a persistent database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(kotlin.Function0)(noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(kotlin.Function0)(noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | android |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(kotlin.Function0)(noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | N |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(kotlin.Function0)(noinline factory: () -> T)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | JS |
| `inline https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(android.content.Context,kotlin.Function0)( context: https://developer.android.com/reference/android/content/Context.html, noinline factory: () -> T )` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | android |
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase> https://developer.android.com/reference/kotlin/androidx/room3/Room#inMemoryDatabaseBuilder(android.content.Context,java.lang.Class)(context: https://developer.android.com/reference/android/content/Context.html, klass: https://developer.android.com/reference/java/lang/Class.html<T>)` Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. | android |

| ### Public properties |
|---|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/room3/Room#MASTER_TABLE_NAME()` The master table name where Room keeps its metadata information. | Cmn android N JS |

## Public functions

### databaseBuilder

android

```
inline fun <T : RoomDatabase> databaseBuilder(
    name: String,
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a RoomDatabase.Builder for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the database file. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### databaseBuilder

android

```
inline fun <T : RoomDatabase> databaseBuilder(
    name: String,
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the database file. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### databaseBuilder

N

```
inline fun <T : RoomDatabase> databaseBuilder(
    name: String,
    noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the database file. |
| `noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then the associated `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` is searched via the `https://developer.android.com/reference/kotlin/androidx/room3/ConstructedBy` annotation and is used to instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### databaseBuilder

JS

```
inline fun <T : RoomDatabase> databaseBuilder(
    name: String,
    noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the database file. |
| `noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then the associated `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` is searched via the `https://developer.android.com/reference/kotlin/androidx/room3/ConstructedBy` annotation and is used to instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### databaseBuilder

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
fun <T : RoomDatabase> databaseBuilder(
    context: Context,
    klass: Class<T>,
    name: String?
): RoomDatabase.Builder<T>
```

Creates a RoomDatabase.Builder for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `context: https://developer.android.com/reference/android/content/Context.html` | The context for the database. This is usually the Application context. |
| `klass: https://developer.android.com/reference/java/lang/Class.html<T>` | The abstract class which is annotated with `https://developer.android.com/reference/kotlin/androidx/room3/Database` and extends `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The name of the database file. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### databaseBuilder

android

```
inline fun <T : RoomDatabase> databaseBuilder(
    context: Context,
    name: String,
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a RoomDatabase.Builder for a persistent database. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `context: https://developer.android.com/reference/android/content/Context.html` | The context for the database. This is usually the Application context. |
| `name: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The name of the database file. If this name is an absolute path it is used as is, otherwise the path to the database will be based on `https://developer.android.com/reference/android/content/Context.html#getDatabasePath(java.lang.String)` from the given `https://developer.android.com/reference/kotlin/androidx/room3/Room#databaseBuilder(android.content.Context,kotlin.String,kotlin.Function0)`. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

android

```
inline fun <T : RoomDatabase> inMemoryDatabaseBuilder(
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in memory database disappears when the process is killed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

android

```
inline fun <T : RoomDatabase> inMemoryDatabaseBuilder(
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in-memory database disappears when the database is closed or the process is killed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

N

```
inline fun <T : RoomDatabase> inMemoryDatabaseBuilder(
    noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in-memory database disappears when the database is closed or the process is killed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then the associated `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` is searched via the `https://developer.android.com/reference/kotlin/androidx/room3/ConstructedBy` annotation and is used to instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

JS

```
inline fun <T : RoomDatabase> inMemoryDatabaseBuilder(
    noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in-memory database disappears when the database is closed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `noinline factory: () -> T = { findDatabaseConstructorAndInitDatabaseImpl(T::class) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then the associated `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor` is searched via the `https://developer.android.com/reference/kotlin/androidx/room3/ConstructedBy` annotation and is used to instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

android

```
inline fun <T : RoomDatabase> inMemoryDatabaseBuilder(
    context: Context,
    noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }
): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in memory database disappears when the process is killed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `context: https://developer.android.com/reference/android/content/Context.html` | The context for the database. This is usually the Application context. |
| `noinline factory: () -> T = { findAndInstantiateDatabaseImpl(T::class.java) }` | An optional lambda calling `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabaseConstructor#initialize()` corresponding to the database class of this builder. If not provided then reflection is used to find and instantiate the database implementation class. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

### inMemoryDatabaseBuilder

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
fun <T : RoomDatabase> inMemoryDatabaseBuilder(context: Context, klass: Class<T>): RoomDatabase.Builder<T>
```

Creates a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder` for an in memory database. Information stored in an in-memory database disappears when the database is closed or the process is killed. Once a database is built, you should keep a reference to it and re-use it.

| Parameters |
|---|---|
| `<T : https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase>` | The type of the database class. |
| `context: https://developer.android.com/reference/android/content/Context.html` | The context for the database. This is usually the Application context. |
| `klass: https://developer.android.com/reference/java/lang/Class.html<T>` | The abstract class which is annotated with `https://developer.android.com/reference/kotlin/androidx/room3/Database` and extends `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase.Builder<T>` | A `RoomDatabaseBuilder<T>` which you can use to create the database. |

## Public properties

### MASTER_TABLE_NAME

Cmn android N JS Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/room3#3.0.0)

```
val MASTER_TABLE_NAME: String
```

The master table name where Room keeps its metadata information.