当前位置:网站首页>There are multiple good constructors and room will problem
There are multiple good constructors and room will problem
2022-07-02 06:38:00 【Xiao Ming Yuan】
problem :
kotlin Update value 1.2.6 version ,room The entity class of the table fails to compile , such as :
@Entity(tableName = "table_hex")
data class HexData constructor( @ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
@ColumnInfo(name = "code")
var code: String = "",
@ColumnInfo(name = "datas")
var datas: String = "") {
constructor() : this(0)
}
The following warnings and exceptions will appear
Warning:(11, 2) Warning : There are multiple good constructors and Room will pick the no-arg construct
When a new field is added , It will fail to compile , Can't find setter
Method , In fact, it was all caused by the above warning
solve :
Add... To the constructor Ignore
Annotations can be
@Entity(tableName = "table_hex")
data class HexData constructor( @ColumnInfo(name = "id")
@PrimaryKey(autoGenerate = true)
var id: Int = 0,
@ColumnInfo(name = "code")
var code: String = "",
@ColumnInfo(name = "datas")
var datas: String = "") {
@Ignore
constructor() : this(0)
}
边栏推荐
- Three suggestions for all students who have graduated and will graduate
- Cglib agent - Code enhancement test
- Top 10 classic MySQL errors
- TensorRT的功能
- [self cultivation of programmers] - Reflection on job hunting Part II
- Self cultivation of programmers - Reflection on job hunting
- Win电脑截图黑屏解决办法
- Sparse array (nonlinear structure)
- pytest(2) mark功能
- IDEA公布全新默认UI,太清爽了(内含申请链接)
猜你喜欢
Log (common log framework)
Distributed transactions: the final consistency scheme of reliable messages
Pytest (2) mark function
Learn about various joins in SQL and their differences
CUDA中的线程层次
Linked list (linear structure)
Cglib agent - Code enhancement test
Redis - hot key issues
Win10网络图标消失,网络图标变成灰色,打开网络设置闪退等问题解决
Thread hierarchy in CUDA
随机推荐
Selenium+msedgedriver+edge browser installation driver pit
IDEA公布全新默认UI,太清爽了(内含申请链接)
程序员的自我修养—找工作反思篇
FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
[literature reading and thought notes 13] unprocessing images for learned raw denoising
pytest(2) mark功能
CUDA中的异步数据拷贝
sprintf_ How to use s
CUDA中内置的Vector类型和变量
Latest CUDA environment configuration (win10 + CUDA 11.6 + vs2019)
Distributed transactions: the final consistency scheme of reliable messages
CUDA user object
Cglib agent - Code enhancement test
Virtualenv and pipenv installation
QQ email cannot receive the email sent by Jenkins using email extension after construction (timestamp or auth...)
MySql索引
由於不正常斷電導致的unexpected inconsistency;RUN fsck MANUALLY問題已解决
Redis - hot key issues
CUDA中的函数执行空间说明符
10 erreurs classiques de MySQL