I am using Room persistent library. I have requirement to add two primary keys in one table and one of the primary key should be auto increment. I don't know exact syntax to achieve this. Below is my Model class:
@Entity(tableName = "newsPapers", primaryKeys =
{"news_paper_id","news_paper_name"})
public class SelectNewsModel {
private int news_paper_id;
@ColumnInfo(name = "image_url")
private String imageUrl;
@ColumnInfo(name = "news_paper_name")
private String newsPaperName;
}
I want to make "news_paper_id" to be auto incremented. How can i make it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…