>我有 2 个这样的模型:
@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;
}
章节类型1和2有2种类型,目前,当我得到章节1时,greenDAO返回所有类型1和2,如何在类书中只获得类型1或2?
尝试执行此查询
Select from Chapter where type = [1 or 2]