DatabaseView
public
abstract
@interface
DatabaseView
implements
Annotation
| androidx.room.DatabaseView |
Marks a class as an SQLite view.
The value of the annotation is a SELECT query used when the view is created.
The class will behave like normal POJOs when it is used in Dao. You can SELECT from
DatabaseView like Entity, but you can not INSERT, DELETE or UPDATE
DatabaseView. You can use ColumnInfo and Embedded inside.
Example:
@DatabaseView("SELECT id, last_name FROM User")
public class UserSummary {
public long id;
@ColumnInfo(name = "last_name")
public String lastName;
}
Views have to be registered to a RoomDatabase via Database.views(). Room will automatically
create a backing SQLite view.
See also:
Summary
Public methods | |
|---|---|
String
|
value()
The SELECT query. |
String
|
viewName()
The view name in the SQLite database. |
Inherited methods | |
|---|---|
Public methods
value
public String value ()
The SELECT query.
| Returns | |
|---|---|
String |
The SELECT query. |
viewName
public String viewName ()
The view name in the SQLite database. If not set, it defaults to the class name.
| Returns | |
|---|---|
String |
The SQLite view name. |
Annotations
Classes
Enums
Exceptions