在受访者的@ToOne关系中找不到SurveyId

时间:2018-07-16 16:21:52

标签: java android android-sqlite greendao

我正在为Android Studio使用greendao 3及其插件。我有以下具有关系的实体类。

受访者类别

@Entity
public class Respondent extends AbstractEntity {
  private Date dateOfBirth;
  private String gender;
  private String fullname;
  private String nationalId;
  @ToMany(referencedJoinProperty = "respondentId")
  private List<Response> responses;
  @ToOne(joinProperty = "surveyId")
  private Survey survey;
}

调查课

@Entity
public class Survey extends AbstractEntity {
  @Unique
  private String name;
  @Unique
  private String code;
  private String description;
  @ToMany(referencedJoinProperty = "surveyId")
  private List<SurveySection> surveySections;
  @ToOne(joinProperty = "locationId")
  private Location location;
  @ToMany(referencedJoinProperty = "surveyId")
  private List<Respondent> respondents;

}

我已将插件按如下所示放在根目录build.gradle中

  dependencies {
    classpath 'com.android.tools.build:gradle:3.1.3'
    classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2'
    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

应用模块插件

apply plugin: 'org.greenrobot.greendao'

依赖项

 implementation 'org.greenrobot:greendao:3.2.2'

但是当我尝试创建项目时,出现以下错误。

Can't find surveyId in Respondent for @ToOne relation

0 个答案:

没有答案