当前位置:网站首页>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)
}
边栏推荐
- selenium备忘录:selenium\webdriver\remote\remote_connection.py:374: ResourceWarning: unclosed<xxxx>解决办法
- Redis - hot key issues
- Uploading attachments using Win32 in Web Automation
- 浏览器滚动加载更多实现
- CUDA中的线程层次
- [self cultivation of programmers] - Reflection on job hunting Part II
- Thread hierarchy in CUDA
- Pytest (3) parameterize
- Idea announced a new default UI, which is too refreshing (including the application link)
- CUDA中的异步数据拷贝
猜你喜欢
默认google浏览器打不开链接(点击超链接没有反应)
Redis——Cluster数据分布算法&哈希槽
There is no way to drag the win10 desktop icon (you can select it, open it, delete it, create it, etc., but you can't drag it)
广告业务Bug复盘总结
web自动中利用win32上传附件
Win10网络图标消失,网络图标变成灰色,打开网络设置闪退等问题解决
Pytest (1) case collection rules
Log (common log framework)
[literature reading and thought notes 13] unprocessing images for learned raw denoising
pytest(1) 用例收集规则
随机推荐
Codeforces Round #797 (Div. 3) A—E
CUDA中的Warp matrix functions
浏览器滚动加载更多实现
pytest(3)parametrize参数化
kali最新更新指南
qq邮箱接收不到jenkins构建后使用email extension 发送的邮件(timestamp 或 auth.......)
selenium+msedgedriver+edge浏览器安装驱动的坑
Cglib agent - Code enhancement test
CUDA中的动态全局内存分配和操作
Sentinel rules persist to Nacos
Render minecraft scenes into real scenes using NVIDIA GPU
Redis - hot key issues
sprintf_s的使用方法
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
Sparse array (nonlinear structure)
js中正则表达式的使用
Android - Kotlin 下使用 Room 遇到 There are multiple good constructors and Room will ... 问题
实习生跑路留了一个大坑,搞出2个线上问题,我被坑惨了
代码技巧——Controller参数注解@RequestParam
Self cultivation of programmers - Reflection on job hunting