Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/211.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 关于oneToMany和ForeignKey的数据流问题_Java_Android_Dbflow - Fatal编程技术网

Java 关于oneToMany和ForeignKey的数据流问题

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

我想在DBFlow中使用OneToMany关系,但出现以下错误:

错误:找不到符号变量parentclass\u parent\u id

代码看起来(简化)如下:

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”)
添加到主键值