Java 关于oneToMany和ForeignKey的数据流问题
我想在DBFlow中使用OneToMany关系,但出现以下错误: 错误:找不到符号变量parentclass\u parent\u id 代码看起来(简化)如下:Java 关于oneToMany和ForeignKey的数据流问题,java,android,dbflow,Java,Android,Dbflow,我想在DBFlow中使用OneToMany关系,但出现以下错误: 错误:找不到符号变量parentclass\u parent\u id 代码看起来(简化)如下: class ParentClass { @Column @PrimaryKey (autoincrement = true) private long parent_id; private ArrayList<ChildClass> childs; @OneToMany(methods = {OneToMany.Met
class ParentClass
{
@Column
@PrimaryKey (autoincrement = true)
private long parent_id;
private ArrayList<ChildClass> childs;
@OneToMany(methods = {OneToMany.Method.ALL}, variableName = "childs")
public ArrayList<ChildClass> getMyChilds() {
if (childs== null || childs.isEmpty()) {
childs= (ArrayList<ChildClass>) SQLite.select()
.from(Child.class)
.where(Child_Table.parentclass_parent_id.eq(parent_id))
.queryList();
}
return childs;
}
}
class ChildClass
{
@ForeignKey(references =
{@ForeignKeyReference(columnName = "parentClassKey",
foreignKeyColumnName = "parent_id")})
ParentClass parentClass;
}
class父类
{
@纵队
@PrimaryKey(自动增量=真)
私有长父id;
私人ArrayList childs;
@OneToMany(methods={OneToMany.Method.ALL},variableName=“childs”)
公共数组列表getMyChilds(){
if(childs==null | | childs.isEmpty()){
childs=(ArrayList)SQLite.select()
.from(Child.class)
.where(Child_Table.parentclass_parent_id.eq(parent_id))
.queryList();
}
返回儿童;
}
}
班级儿童班
{
@外键(参考文献)=
{@ForeignKeyReference(columnName=“parentClassKey”,
foreignKeyColumnName=“parent_id”)})
父类父类;
}
知道怎么回事吗?将@Column(name=“parentclass\u parent\u id”)
添加到主键值。将@Column(name=“parentclass\u parent\u id”)
添加到主键值