Android表创建失败(编译时:CREATE TABLE IF NOT NOT EXISTS

时间:2018-05-07 11:00:59

标签: sqlite

编译时:

CREATE TABLE IF NOT EXISTS `SeasonMasterDB` 
  (`id` INTEGER PRIMARY KEY AUTOINCREMENT, 
   `id` TEXT PRIMARY KEY AUTOINCREMENT, `name` TEXT
  ); 

这就是您收到错误的原因。请帮帮我,这是我的代码:

@Table(name = "SeasonMasterDB",database = AppDatabase.class)`enter code here`
    public class SeasonMasterDB extends Model {
    @PrimaryKey
    public Long id;
    @Column(name = "id")
    public String idValue;

    @Column(name = "name")
    public String name;

    public SeasonMasterDB()
    {
    }

    public SeasonMasterDB(String name,String id)
    {
        this.idValue = id;
        this.name = name;
    }
}

1 个答案:

答案 0 :(得分:0)

您不能拥有两个名称相同的列。重命名一个id列。