Caused by: java.sql.SQLException: Field 'stu_id' doesn't have a default value
来源:互联网 发布:c语言数据类型长度代码 编辑:程序博客网 时间:2024/04/29 16:19
1、错误描述
### Cause: java.sql.SQLException: Field 'stu_id' doesn't have a default value; SQL []; Field 'line_id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'stu_id' doesn't have a default valueat org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:243)at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:73)at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:71)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)at com.sun.proxy.$Proxy18.insert(Unknown Source)at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:236)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123)at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208))at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:745)Caused by: java.sql.SQLException: Field 'stu_id' doesn't have a default valueat com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996)at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:137)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:606)at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)... 98 more
2、错误原因
在做学生信息表插入操作时,stu_id字段(主键)不是自增长的,前台也没有传值,导致报错
3、解决办法
(1)前台添加stu_id录入框
(2)后台拼接SQL语句,需要加上stu_id
0 0
- Caused by: java.sql.SQLException: Field 'stu_id' doesn't have a default value
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value .
- Hibernate出现Caused by: java.sql.SQLException: Field 'id' doesn't have a default value原因
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- Caused by: java.sql.SQLException: Field 'create_time' doesn't have a default value
- Hibernate中Caused by: java.sql.SQLException: Field 'address_id'doesn't have a default value
- Caused by: java.sql.SQLException: Field 'id' doesn't have a default value
- cause by: java.sql,SQLException: Field 'pid' doesn't have a default value
- java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value
- java.sql.SQLException: Field 'Qid' doesn't have a default value
- java.sql.SQLException: Field 'id' doesn't have a default value
- java.sql.SQLException: Field 'ReviewId' doesn't have a default value
- java.sql.SQLException: Field 'name' doesn't have a default value
- java.sql.SQLException: General error, message from server: "Field 'ID' doesn't have a default value
- java.sql.SQLException: Field 'id' doesn't have a default value
- ajax开发中的跨域
- Java 并发:内置锁 Synchronized
- 小程序不是要点,业务才是本质
- Android WebView 加载网页遇到的问题
- CAS单点登录例子
- Caused by: java.sql.SQLException: Field 'stu_id' doesn't have a default value
- 274. H-Index**
- small插件化方案踩坑
- C++ 实战测试——电子老鼠闯迷宫(BFS)
- 1122. Hamiltonian Cycle (25)
- 真随机数&&伪随机数
- 文件File
- WebSocket详解(二)应用实例
- 职位名称: Java技术经理