在做mybatis插入的时候报了这个错误,百度了下,貌似是因为这个健没有设置值且不是自增类型的。

java.sql.SQLException: Field 'id' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965) ~[mysql-connector-java-5.1.46.jar:5.1.46]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976) ~[mysql-connector-java-5.1.46.jar:5.1.46]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3912) ~[mysql-connector-java-5.1.46.jar:5.1.46]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530) ~[mysql-connector-java-5.1.46.jar:5.1.46]

只有到数据库把这张表设置成自增类型的就ok了

java.sql.SQLException: Field 'id' doesn't have a default value异常的更多相关文章

  1. Caused by: java.sql.SQLException: Field 'id' doesn't have a default value

    1.错误描述 org.hibernate.exception.GenericJDBCException: error executing work at org.hibernate.exception ...

  2. java.sql.SQLException: Field 'id' doesn't have a default value

    1:id 列要设置成自增,自动赋值 java.sql.SQLException: Field 'id' doesn't have a default value at com.mysql.jdbc.S ...

  3. Hibernate报错:Caused by: java.sql.SQLException: Field 'ID' doesn't have a default value

    问题一: 报错如下: org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assig ...

  4. java.sql.SQLException: Field 'id' doesn't have a default value解决方案

    转自:https://blog.csdn.net/xinghuo0007/article/details/51810867 自增长:java.sql.SQLException: Field 'id' ...

  5. 启动Spring boot报错:nested exception is java.sql.SQLException: Field 'id' doesn't have a default value

    先看具体日志: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with n ...

  6. java.sql.SQLException: Field 'id' doesn't have a default value(用eclipse操作数据库时报了这种奇怪的错误)的原因与解决方法

    1.错误原因 由于id在数据库表中是作为主键,但是在插入的过程中,没有给予数值,并且没有让其自增 2.解决办法 修改数据库表中的id,让其自增(在插入的过程中,不插入id数据时)

  7. 异常java.sql.SQLException: Field 'id' doesn't have a default value

    使用spring data jpa出现这个情况. entity中的自增策略已经加好了. 还是出现这个异常.去数据库中查看,发现没有给主键加上自增. 出现这个问题去实体类跟数据库中看一下就可以了.

  8. Hive报错之java.sql.SQLException: Field 'IS_STOREDASSUBDIRECTORIES' doesn't have a default value

    在创建表的时候报出如下错误: hive> create table if not exists testfile_table( > site string, > url string ...

  9. Caused by: java.sql.SQLException: Field 'category_id' doesn't have a default value

    ### The error may involve com.qingmu.core.dao.ad.ContentDao.insertSelective-Inline ### The error occ ...

随机推荐

  1. 笨办法学Python(八)

    习题 8: 打印,打印 formatter = "%r %r %r %r" print formatter % (1, 2, 3, 4) print formatter % (&q ...

  2. COGS 146. [USACO Jan08] 贝茜的晨练计划

    ★☆   输入文件:cowrun.in   输出文件:cowrun.out   简单对比时间限制:1 s   内存限制:32 MB 奶牛们打算通过锻炼来培养自己的运动细胞,作为其中的一员,贝茜选择的运 ...

  3. 支持多域名的免费SSL证书

    知乎网友称其支持多域名: https://www.zhihu.com/question/19578422 配置教程: https://www.cnblogs.com/duanweishi/p/8483 ...

  4. OpenGL学习 Following the Pipeline

    Passing Data to the Vertex Shader Vertex Attributes At the start of the OpenGL pipeline,we use the i ...

  5. OpenGL学习 Our First OpenGL Program

    This shows you how to create the main window with the book’s application framework and how to render ...

  6. java——栈和队列 面试题

    (1)栈的创建 (2)队列的创建 (3)两个栈实现一个队列 (4)两个队列实现一个栈 (5)设计含最小函数min()的栈,要求min.push.pop.的时间复杂度都是O(1) (6)判断栈的push ...

  7. *1 Two Sum two pointers(hashmap one scan)

    Given an array of integers, return indices of the two numbers such that they add up to a specific ta ...

  8. node执行环境

    nodejs本质上是一个javascript的执行环境,只是由于他的封装,加上更多web底层的一个处理,赋予了更多的能力,那么执行环境到底是什么呢,我们到浏览器里面体验看看,在chrome里面控制台, ...

  9. ios RSA 验签加密解密

    关于公钥和私钥的生成,网上有很多本地生产的方法,我遇到的问题是,按照网上生产的方式生成7个文件,本地使用没有问题,但是和后台交互就不行了. 发现生成公钥和私钥的没有那么麻烦,使用在线生产工具就能使用, ...

  10. C#继承简介与规则

    一.C#继承简介 1. 类的层次结构 下面是一个类的层次结构图: 上图反映了鱼类的派生关系,其中最高层的实体往往具有最一般最普遍的特征,越下层的实体就越具体,并且下层包含了上层的特征.如果将上层的实体 ...