Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/209.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
Android DBFlow-使用整型外键_Android_Orm_Android Sqlite_Dbflow - Fatal编程技术网

Android DBFlow-使用整型外键

Android DBFlow-使用整型外键,android,orm,android-sqlite,dbflow,Android,Orm,Android Sqlite,Dbflow,我是安卓系统的新手。在应用程序上使用DBFlow映射数据库时遇到问题 首先,我将讨论我的数据库模式 集合(msg\u键INTEGER主键,message\u idINTEGER,…) 消息(消息id:整数主键,…) 和我的Java代码在同一个包中 消息类: @Table(database = MyDatabase.class, name = Constants.TBL_MESSAGE, allFields = true) public class Message extends BaseMode

我是安卓系统的新手。在应用程序上使用
DBFlow
映射数据库时遇到问题

首先,我将讨论我的数据库模式

集合
msg\u键
INTEGER主键,
message\u id
INTEGER,…)

消息
消息id
:整数主键,…)

和我的Java代码在同一个包中

消息
类:

@Table(database = MyDatabase.class, name = Constants.TBL_MESSAGE, allFields = true)
public class Message extends BaseModel {

    @PrimaryKey
    int message_id;
    String description;
}
@Table(database = MyDatabase.class, name = Constants.TBL_COLLECTION, allFields = true)
public class Collection extends BaseModel {
    @Column(setterName = "setMsg_key", getterName = "getMsg_key")
    @PrimaryKey
    private int msg_key;

    @Column(setterName = "setMessage_id", getterName = "getMessage_id")
    @ForeignKey(references = {
            @ForeignKeyReference(columnType = Integer.class,
                    columnName = Constants.TBL_COL_MSG,
                    foreignKeyColumnName = Constants.TBL_MSG_ID)}
            , saveForeignKeyModel = false)
    private Message message_id;

    public void setMessage_id(Message message_id) {
        this.message_id = message_id;
    }

    public void setMsg_key(int msg_key) {
        this.msg_key = msg_key;
    }

    public int getMsg_key() {
        return msg_key;
    }

    public Message getMessage_id() {
        return message_id;
    }
}
集合
类别:

@Table(database = MyDatabase.class, name = Constants.TBL_MESSAGE, allFields = true)
public class Message extends BaseModel {

    @PrimaryKey
    int message_id;
    String description;
}
@Table(database = MyDatabase.class, name = Constants.TBL_COLLECTION, allFields = true)
public class Collection extends BaseModel {
    @Column(setterName = "setMsg_key", getterName = "getMsg_key")
    @PrimaryKey
    private int msg_key;

    @Column(setterName = "setMessage_id", getterName = "getMessage_id")
    @ForeignKey(references = {
            @ForeignKeyReference(columnType = Integer.class,
                    columnName = Constants.TBL_COL_MSG,
                    foreignKeyColumnName = Constants.TBL_MSG_ID)}
            , saveForeignKeyModel = false)
    private Message message_id;

    public void setMessage_id(Message message_id) {
        this.message_id = message_id;
    }

    public void setMsg_key(int msg_key) {
        this.msg_key = msg_key;
    }

    public int getMsg_key() {
        return msg_key;
    }

    public Message getMessage_id() {
        return message_id;
    }
}
作为

作为_适配器类,所有字段都必须是公共的或包专用的 需要访问它们。注意:包专用字段不必位于 与DBFlow相同的包将生成 找到他们

或仅当指定get{Name}()和 为名为{Name}的列设置{Name}(columnType)方法。这可能是 配置

但是当我构建应用程序时,android studio抛出了一个错误

错误:不可比较的类型:int和

然后通过DBFlow检查
生成的代码
,并实现其compare int与null的比较

我不确定这是
DBFlow
bug还是我在某个地方缺少/错误的配置? 请给我你的建议/解决方案

谢谢

================更新=============


我正在使用dbflow3.0.0beta3

我投票结束这个问题,因为:Libray bug