mybatis 为何我的id已经设置了主键自增,仍然报id不能为空? 您所在的位置:网站首页 携程uid不能为空 mybatis 为何我的id已经设置了主键自增,仍然报id不能为空?

mybatis 为何我的id已经设置了主键自增,仍然报id不能为空?

2023-07-21 08:49| 来源: 网络整理| 查看: 265

//上图是表信息

//控制台错误信息

### Error updating database.  Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'id' cannot be null ### The error may exist in com/dun/mapper/AccountMapper.java (best guess) ### The error may involve com.dun.mapper.AccountMapper.save-Inline ### The error occurred while setting parameters ### SQL: insert into accounts values(?,?,?) ### Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'id' cannot be null ; Column 'id' cannot be null; nested exception is java.sql.SQLIntegrityConstraintViolationException: Column 'id' cannot be null

//代码信息

public interface AccountMapper { @Insert("insert into accounts values(#{id},#{name},#{money})") public void save(Account account); @Select("select * from accounts") public List findAll(); }


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有