使用mybatis-plus时候报错Error updating database.subject_parent_id‘ doesn‘t have a default value
使用mybatis-plus时候报错Error updating database. Cause: java.sql.SQLException: Field ‘subject_parent_id’ doesn’t have a default value
误代码如图:
org.springframework.dao.DataIntegrityViolationException:
Error updating database. Cause: java.sql.SQLException: Field ‘subject_parent_id’ doesn’t have a default value
The error may involve com.atguigu.eduservice.mapper.EduCourseMapper.insert-Inline
The error occurred while setting parameters
SQL: INSERT INTO edu_course ( id, teacher_id, subject_id, title, price, lesson_num, cover, gmt_create, gmt_modified ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? )
Cause: java.sql.SQLException: Field ‘subject_parent_id’ doesn’t have a default value
; Field ‘subject_parent_id’ doesn’t have a default value; nested exception is java.sql.SQLException: Field ‘subject_parent_id’ doesn’t have a default value
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:247)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
at org.mybatis.spring.SqlSessionTemplateSqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)atcom.sun.proxy.SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446) at com.sun.proxy.SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)atcom.sun.proxy.Proxy86.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
由于使用mybatis-plus代码生成器, 不能设置自增id, 所有不能用自增去解决
后来我发现把 ‘subject_parent_id’ 非空√去掉就好了
添加成功, 如图:
{
“success”: true,
“code”: 20000,
“message”: “成功”,
“data”: {
“courseId”: “string”
}
}
这样就成功了能够运行
使用mybatis-plus时候报错Error updating database.subject_parent_id‘ doesn‘t have a default value相关推荐
- 关于报错ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging
在进行单元测试的时候,出现log4j报错ERROR StatusLogger No log4j2 configuration file found. Using default configurati ...
- 启动ElasticSearch报错:error updating geoip database
问题描述: 启动ElasticSearch报错: error updating geoip database [2021-12-22T21:07:11,944][INFO ][o.e.i.g.GeoI ...
- Mybatis报错: Error querying database. Cause: java.lang.NumberFormatException: For input string: “A“
报错信息:Error querying database. Cause: java.lang.NumberFormatException: For input string: "A" ...
- 使用mybatis分页插件报错Error parsing SQL Mapper Configuration; Cause: java.lang.ClassCastException: com.gith
(标题刚刚好100/100 使用报错具体如下: ### Error building SqlSession. ### The error may exist in SQL Mapper Configu ...
- 报错Error querying database. Cause:java.lang.NullPointException
最近遇到这样一个问题: 后台显示: 后台查询到数据库全是空 解决方案: 从前端获得日期类型得加@DateTimeFormat(pattern = "yyyy-MM-dd")这个注解 ...
- 运行mybatis时显示报错:Error updating database. Cause: java.sql.SQLException: Error setting driver on
在运行mybatis测试类的时候,结果报错; Error updating database. Cause: java.sql.SQLException: Error setting driver o ...
- 解决执行Mysql报错: ERROR: The server quit without updating PID file (/data/xxx.pid)
昨天在Linux中安装mysql-8.0.28时遇到了这个报错: ERROR! The server quit without updating PID file (/data/xxx.pid) 其实 ...
- mysql 启动报错 ERROR The server quit without updating PID file
mysql 启动报错 : ERROR! The server quit without updating PID file (/usr/local/var/mysql/bogon.pid). 今天莫名 ...
- Mysql + Mybatis批量更新报错 BadSqlGrammarException
报错 项目启动没问题,查询删除等接口都没问题,Mybatis写法和SQL都没问题,数据也都没问题,批量更新数据时,报错如下 2022-03-29 10:20:37.880 ERROR 133132 - ...
最新文章
- 深度学习时代的目标检测算法综述
- 【原创】Team Foundation Server 域环境迁移
- objective-c 编写规范_Objective-c成员变量的定义方式?如何写才规范?
- 允许服务与桌面交互_在后全面屏时代 手机需要什么样的人机交互?
- go语言函数的常用用法
- css居中最佳方案,CSS 水平、垂直居中的5种最佳方案
- MacOS平台上编译 hadoop 3.1.2 源码
- rancher的使用感受以及与k8s的对比
- Java并发(基础知识)—— 创建、运行以及停止一个线程
- sql 不允许保存更改 解决办法
- APP 接口拦截与参数破解
- Mac常用快捷键组合
- java poc_spring系列cve poc编写
- 前端工作中的一些解决问题的方法,可以参考一下
- sgsn与ggsn的区别与联系
- 宝宝树全自动引流脚本软件高质量活跃粉丝
- android markdown 笔记,安卓-纯纯写作 | 快速笔记 Markdown
- YOLOv7改进主干系列:首发结合最新 QARepVGG 升级Rep结构, 本文对其进行原创改进 QARepNeXt 结构,基于美团提出一种量化感知方法:再一次让 RepVGG 变得更好
- 求帮忙解决图灵机器人运行不回复的问题
- 需求分析挑战之旅(疯狂的订餐系统)(1)——某IT公司员工的吃饭问题
热门文章
- 【原创】 shell一键配置squid高匿代理服务器 high-Anonymity
- JDBC最简单的使用
- STM32F7 ADC+DMA 目标数组无更新 解决办法
- 【MLDL】【skimming】ACNet: Strengthening the Kernel Skeletons for Powerful CNN
- 30秒完成工作?终于知道Python这个技能有多重要!
- Makefile控制函数error和warning
- 26、资金管理-账户管理
- 双向口和准双向口有什么区别
- 3. Python 面向对象编程
- AEIA2018 | 四维图新白新平:智慧赋能,共建生态