1:id 列要设置成自增,自动赋值

java.sql.SQLException: Field 'id' doesn't have a default value
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3593)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3525)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1986)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2140)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2626)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2111)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2407)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2325)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2310)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2723)
at com.alibaba.druid.wall.WallFilter.preparedStatement_executeUpdate(WallFilter.java:621)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
at com.alibaba.druid.filter.FilterAdapter.preparedStatement_executeUpdate(FilterAdapter.java:1069)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_executeUpdate(FilterEventAdapter.java:491)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_executeUpdate(FilterChainImpl.java:2721)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.executeUpdate(PreparedStatementProxyImpl.java:145)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:253)
at org.springframework.jdbc.core.JdbcTemplate.lambda$update$1(JdbcTemplate.java:882)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:605)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:881)
at com.gupaoedu.vip.orm.framework.BaseDaoSupport.doInsertRuturnKey(BaseDaoSupport.java:1350)
at com.gupaoedu.vip.orm.framework.BaseDaoSupport.insertAndReturnId(BaseDaoSupport.java:168)
at com.gupaoedu.vip.orm.demo.dao.MemberDao.insert(MemberDao.java:101)
at OrmTest.testInsert(OrmTest.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestExecutionCallbacks.evaluate(RunBeforeTestExecutionCallbacks.java:73)
at org.springframework.test.context.junit4.statements.RunAfterTestExecutionCallbacks.evaluate(RunAfterTestExecutionCallbacks.java:83)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:251)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:97)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:190)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

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. 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 ...

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

    在做mybatis插入的时候报了这个错误,百度了下,貌似是因为这个健没有设置值且不是自增类型的. java.sql.SQLException: Field 'id' doesn't have a de ...

  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. RPM包指令总结

    一.RPM RPM包安装位置 RPM包默认安装路径 /etc/ 配置文件安装目录 /usr/bin/ 可执行的命令安装目录 /usr/lib/ 程序所使用的函数库保存位置 /usr/share/doc ...

  2. --- rk3399/3288 系列平台接mipi 的dts 数据 panel-init-sequence = [] 命令的整法

    https://blog.csdn.net/Shushan1/article/details/87858434 mipi 屏的数据手册 dts sample: &dsi { status = ...

  3. Traceback (most recent call last): File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\_vendored\pydevd\_pydevd_bundle\pyd

    某次编码,debug的时候突然突然突然给我报这个错: Traceback (most recent call last):   File "c:\program files (x86)\mi ...

  4. 三个猜数字游戏代码(Python)

    def binary_search(list,item): low = 0 high = len(list)-1 while low <= high: mid = (low + high)//2 ...

  5. 2019 AI CITY CHALLENGE

    官网:    https://www.aicitychallenge.org/ 基于来自交通,信号系统,基础设施和运输的传感器数据,存在使运输系统更智能的巨大机会.不幸的是,由于几个原因,进展受到限制 ...

  6. 微信小程序--录音

    var app = getApp(), $ = require("../../utils/util.js"); const recorderManager = wx.getReco ...

  7. Game Engine Architecture 11

    [Game Engine Architecture 11] 1.three most-common techniques used in modern game engines. 1)Cel Anim ...

  8. nginx开机启动

    centos 7以上是用Systemd进行系统初始化的 Systemd服务文件以.service结尾,比如现在要建立nginx为开机启动,如果用yum install命令安装的,yum命令会自动创建n ...

  9. DVWA中low级的sql注入漏洞的简单复现

    第一次成功复现一个简单漏洞,于是写下这篇随笔记录一下 首先我们来看dvwa中low级的sql注入的源码 源码文件路径如下图: 源码如下: <?php if(isset($_GET['Submit ...

  10. java批量生成用例脚本-保留字关键词的用例脚本生成

    20171012新补丁包程序,程序整理了全部的关键字和保留字,支持 字段a = "字段b" 与 字段a = 字段b,并做了代码重构.对补丁包进行关键字专项测试,验证关键字保留字作为 ...