2015-11-10 78 views
0

這是我的模型,其中我自己維護了ID。用於創建和更新記錄的ActiveAndroid自定義主鍵

表(姓名= 「主」) 公共類碩士擴展模式{

@Column(name = "masterId") 
public int id; 

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

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

}

如何設置我的自定義列爲主,支持創建和更新。在註解@Table

回答

2

用戶ID來定義您的自定義ID

@Table(name = "Items", id = "_id") 
public class Master extends Model { 

    @Column(name = "masterId") 
    public int id; 

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

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

} 
相關問題