create table temp(id int,userId int,query text,createdOn text,primary key(id,userId));
如何使用ormlite创建id和UserId作为一个主键?
@DatabaseField(columnName = "_id",id = true,generatedId = true)
private long _id;
@DatabaseField(columnName = "userId")
private String userId;
@DatabaseField(columnName = "query")
public String query;
@DatabaseField(columnName = "createdOn")
public String createdOn;
答案 0 :(得分:1)
@DatabaseField(columnName = "_id",id = true,generatedId = true)
private long _id;
_id当你使用generatedId = true;
时它是主键