Answer the question
In order to leave comments, you need to log in
PrimaryKey vs composite key, difference?
I can specify a key to a field, or I can create a composite key, but I don't understand the difference. That is, I can specify a key to the field, and I receive data using this key, or I can specify a composite key, but I don’t understand what a composite key means.
@Entity()
open class User(
@PrimaryKey
@ColumnInfo(name = "idUser")
var id:Int,
@ColumnInfo(name="nameUser")
var name:String
)
@Entity(primaryKeys = ["idUser","nameUser"])
open class User(
@ColumnInfo(name = "idUser")
var id:Int,
@ColumnInfo(name="nameUser")
var name:String
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question