# Dao

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- Cmn

  ```
  @Target(allowedTargets = [AnnotationTarget.CLASS])
  @Retention(value = AnnotationRetention.BINARY)
  annotation Dao
  ```

*** ** * ** ***

Marks the class as a Data Access Object.

Data Access Objects are the main classes where you define your database interactions. They can include a variety of query methods.

The class marked with `@Dao` should either be an interface or an abstract class. At compile time, Room will generate an implementation of this class when it is referenced by a `https://developer.android.com/reference/kotlin/androidx/room3/RoomDatabase` that is annotated with `https://developer.android.com/reference/kotlin/androidx/room3/Database`.

An abstract `@Dao` class can optionally have a constructor that takes a `https://developer.android.com/reference/kotlin/androidx/room3/Database` as its only parameter:

```kotlin
@Dao
abstract class SongDao(private val database: RoomDatabase) {
    // ...
}
```

It is recommended to have multiple `Dao` classes in your codebase depending on the tables they access.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/Query` |   |
| `https://developer.android.com/reference/kotlin/androidx/room3/Insert` |   |
| `https://developer.android.com/reference/kotlin/androidx/room3/Delete` |   |
| `https://developer.android.com/reference/kotlin/androidx/room3/Update` |   |
| `https://developer.android.com/reference/kotlin/androidx/room3/Upsert` |   |
| `https://developer.android.com/reference/kotlin/androidx/room3/RawQuery` |   |

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/room3/Dao#Dao()()` | Cmn |

## Public constructors

### Dao

Cmn

```
Dao()
```