对我来说,我在kotlin的data(Entity)类中使用了'lat'和'long'作为变量名,因此重命名为经度和纬度可以正常工作。
无法运作:
@Entity(tableName = "table_User")
data class User(@PrimaryKey var userId : Int, @ColumnInfo(name = "first_name")
var firstName: String
, @ColumnInfo(name = "last_name") var lastName: String
, @ColumnInfo(name = "password") var password: String
, @ColumnInfo(name = "dob") var dob: Long
, @ColumnInfo(name = "address") var address: String
, @ColumnInfo(name = "lat") var latitude: Double
, @ColumnInfo(name = "long") var longitude: Double) {
}
加工:
@Entity(tableName = "table_User")
data class User(@PrimaryKey var userId : Int, @ColumnInfo(name = "first_name")
var firstName: String
, @ColumnInfo(name = "last_name") var lastName: String
, @ColumnInfo(name = "password") var password: String
, @ColumnInfo(name = "dob") var dob: Long
, @ColumnInfo(name = "address") var address: String
, @ColumnInfo(name = "latitude") var latitude: Double
, @ColumnInfo(name = "longitude") var longitude: Double) {
}