java.sql.SQLIntegrityConstraintViolationException: Column ‘username‘ cannot be null

错误类型
java.sql.SQLIntegrityConstraintViolationException: Column ‘username’ cannot be null

Caused by: java.sql.SQLIntegrityConstraintViolationException: Column 'username' cannot be null
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:115)
 at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:95)
 at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
 at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:960)
 at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:388)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
 at org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.java:172)
 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:483)
 at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
 at com.sun.proxy.$Proxy27.execute(Unknown Source)
 at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:46)
 at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
 at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
 at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
 at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
 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:483)
 at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63)
 at com.sun.proxy.$Proxy25.update(Unknown Source)
 at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
 at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
 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:483)
 at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:426)
 ... 48 more

错误原因
在这里插入图片描述
负责文件上传的表单和一般表单是有区别的。

解决办法
将上图中红框去删除掉就可以了
在这里插入图片描述
导致此种错误的原因多种多样,这只是其中一种原因,仅供参考

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
java.sql.SQLIntegrityConstraintViolationException: Column 'buiID' cannot be null是一个数据库完整性约束错误。它表示在插入或更新数据时,buiID列的值不能为空。这意味着该列被定义为非空列,并且数据表的约束要求必须为每个记录提供一个非空值。 根据你提供的引用,错误可能是由于在postman中发送的请求参数中,buiID参数的值为空导致的。请确保在postman中正确设置了buiID参数的值,并且值不能为null。 此外,根据引用,还可能是由于数据库表定义了外键约束,并且外键关联的表中没有与buiID对应的记录。如果是这种情况,你需要确保buiID参数的值在关联表中有对应的记录。 因此,你需要检查postman中的参数设置和数据库表的定义,以确保buiID参数的值不为空,并且在关联表中有对应的记录。这样才能解决java.sql.SQLIntegrityConstraintViolationException: Column 'buiID' cannot be null的问题。<span class="em">1</span><span class="em">2</span> #### 引用[.reference_title] - *1* [报错 Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘xxxxxxxx‘ cannot be null](https://blog.csdn.net/weixin_45606985/article/details/129116193)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* [Caused by: java.sql.SQLIntegrityConstraintViolationException: Cannot delete or update a parent row:](https://download.csdn.net/download/weixin_38500572/13684759)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值