Observable query return type (LiveData, Flowable, DataSource, DataSourceFactory etc) can only be used with SELECT queries that directly or indirectly (via @Relation, for example) access at least one table. For @RawQuery, you should specify the list of tables to be observed via the observedEntities field.
Room
用 @RawQuery
查看数据库,返回 LiveData
类型,报如上错误。
解决
添加 observedEntities
@RawQuery(observedEntities = [ConcurrentEvent::class])
fun getFilterEventList2(query: SupportSQLiteQuery): LiveData<List<ConcurrentEvent>>
RawQuery methods can return observable types but you need to specify which tables are accessed in the query using the observedEntities() field in the annotation.
RawQuery
可以返回observable类型, 但是你需要指定在查询中访问的表所对应的实体类