我有两个这样的模型:
@Entity
public class Book {
@Id
Long _id;
String name;
@ToMany(referencedJoinProperty = "bookId")
List<Chapter> chapters1;
@ToMany(referencedJoinProperty = "bookId")
List<Chapter> chapters2;
}
@Entity
public class Chapter {
@Id
Long _id;
String name;
int type;
long bookId;
@ToOne(joinProperty = "bookId")
Book book;
}
有2种类型的章节type1和2,目前,当我得到chapters1时,GreenDAO返回所有type1和2,我怎么能在Book类中只得到type1或2?
尝试执行以下查询
Select from Chapter where type = [1 or 2]