Android Room 2.1.0-alpha03 @DatabaseView缺少语法检查和视图名称

时间:2018-12-28 18:47:31

标签: android-room

我在AndroidX分支上使用roomVersion ='2.1.0-alpha03'

// Room (androidx)
implementation "androidx.room:room-runtime:$rootProject.roomVersion"
implementation "androidx.room:room-rxjava2:$rootProject.roomVersion"
implementation "androidx.room:room-guava:$rootProject.roomVersion"
testImplementation "androidx.room:room-testing:$rootProject.roomVersion"
annotationProcessor "androidx.room:room-compiler:$rootProject.roomVersion"

这是我的@DatabaseView查询:

@DatabaseView("SELECT * FROM DataPointJoin " +
    "INNER JOIN Device ON Device.device_uid = DataPointJoin.device_uid " +
    "INNER JOIN Measurement ON Measurement.measurement_uid = DataPointJoin.measurement_uid " +
    "INNER JOIN Location ON Location.location_uid = DataPointJoin.location_uid " +
    "INNER JOIN User ON User.user_uid = DataPointJoin.user_uid " +
    "INNER JOIN SyncRecord ON SyncRecord.sync_uid = DataPointJoin.uid ")

这是我的用法示例:

@Query("SELECT * FROM DataPoint WHERE DataPoint.uid = :uid")
Flowable<Optional<DataPoint>> get(String uid);

在使用@DatabaseView()将联接封装到View中时,以及在清理并重建后:

  1. 我的@DatabaseView查询没有像在@Query()中那样被检查或突出显示,只是一个普通的长字符串。 enter image description here
  2. 已编译,但是IDE无法解析View符号。 enter image description here

0 个答案:

没有答案