当前位置:网站首页>MP使用时的几个常见报错
MP使用时的几个常见报错
2022-07-31 02:59:00 【qq_45860901】
一,日期的自动插入报null,但是MetaObjectHandler已经配置
描述:
解决:
如下metaobject已经配置还是报错。
实际的问题原因是实体类的对应属性的类型不是LocalDateTime 而是Date,应改为LocalDateTime。
将Date改为LocalDateTime
二,主键id没有报错没有default value
描述:
org.springframework.dao.DataIntegrityViolationException:
Error updating database. Cause: java.sql.SQLException: Field ‘subject_parent_id’ doesn’t have a default value
解决;
数据库中要对id注解设置自增
三,Parameter ‘MP_OPTLOCK_VERSION_ORIGINAL’ not found.
当使用updateById 方法, 且更新的字段中含有version字段时,会默认使用MP的乐观锁。
sql中会多一个version条件。
解决:
第一种:更新的字段中不要包含version字段。
第二种:可使用Mapper 的update 方法。
边栏推荐
- 【C语言基础】解决C语言error: expected ‘;‘, ‘,‘ or ‘)‘ before ‘&‘ token
- 8. Unified exception handling (controller notifies @ControllerAdvice global configuration class, @ExceptionHandler handles exceptions uniformly)
- 【HCIP】ISIS
- Local area network computer hardware information collection tool
- LeetCode中等题之分数加减运算
- SQL注入 Less54(限制次数的SQL注入+union注入)
- TCP/IP四层模型
- Difference between CMOS and TTL?
- 什么是系统?
- Go 项目实战-获取多级分类下的全部商品
猜你喜欢
10 Permission introduction
知识蒸馏7:知识蒸馏代码详解
Project (5) - Small target detection tph-yolov5
全流程调度——MySQL与Sqoop
YOLOV5 study notes (2) - environment installation + operation + training
String为什么不可变?
StringJoiner详解
10. Redis implements likes (Set) and obtains the total number of likes
Compile Hudi
STM32CUBEMX develops GD32F303 (11) ---- ADC scans multiple channels in DMA mode
随机推荐
YOLOV5学习笔记(二)——环境安装+运行+训练
【Bank Series Phase 1】People's Bank of China
Installation of mysql5.7.37 under CentOS7 [perfect solution]
SQL injection Less54 (limited number of SQL injection + union injection)
Difference between CMOS and TTL?
LeetCode中等题之分数加减运算
Modbus on AT32 MCU
Live Preview | KDD2022 Doctoral Dissertation Award Champion and Runner-up Dialogue
Why is String immutable?
LeetCode简单题之找到和最大的长度为 K 的子序列
Mycat's master-slave relationship, vertical sub-database, horizontal sub-table, and detailed configuration of mycat fragmented table query (mysql5.7 series)
10 Permission introduction
The modification is not properly placed in the sandbox, causing Apple compatibility issues
Word/Excel fixed table size, when filling in the content, the table does not change with the cell content
10、Redis实现点赞(Set)和获取总点赞数
Mysql 45讲学习笔记(二十五)MYSQL保证高可用
STM32问题合集
The principle of complete replication of virtual machines (cloud computing)
execsnoop tool
C primer plus学习笔记 —— 8、结构体