当前位置:网站首页>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 方法。
边栏推荐
- 10. Redis implements likes (Set) and obtains the total number of likes
- STM32CUBEMX develops GD32F303 (11) ---- ADC scans multiple channels in DMA mode
- Graphical lower_bound & upper_bound
- SonarQube的BUG定义
- The application of AI in the whole process of medical imaging equipment
- execsnoop 工具
- 共模电感的仿真应用来了,满满的干货送给大家
- 15. Website Statistics
- 16、热帖排行
- LeetCode Daily Question 2022/7/25-2022/7/31
猜你喜欢
Project (5) - Small target detection tph-yolov5
The application of AI in the whole process of medical imaging equipment
接口测试关键技术
品牌广告投放平台的中台化应用与实践
Mathematics to solve the problem - circular linked list
Difference between CMOS and TTL?
What is distributed and clustered?What is the difference?
【银行系列第一期】中国人民银行
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
软件积累 -- 截图软件ScreenToGif
随机推荐
学习DAVID数据库(1)
YOLOV5学习笔记(三)——网络模块详解
开题报告之论文框架
测试中的误报和漏报同样的值得反复修正
Word/Excel fixed table size, when filling in the content, the table does not change with the cell content
The modification is not properly placed in the sandbox, causing Apple compatibility issues
CentOS7下mysql5.7.37的卸载【完美方案】
10. Redis implements likes (Set) and obtains the total number of likes
Refuse to work overtime, a productivity tool set developed by programmers
【C语言】表达式求值的一般方法
Chapter 9 SVM实践
VS QT——ui不显示新添加成员(控件)||代码无提示
LeetCode 每日一题 2022/7/25-2022/7/31
LeetCode Daily Question 2022/7/25-2022/7/31
STM32CUBEMX develops GD32F303 (11) ---- ADC scans multiple channels in DMA mode
SQL 面试用题(重点)
The simulation application of common mode inductance is here, full of dry goods for everyone
12 Disk related commands
TCP/IP四层模型
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care