Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘businessName‘ cannot be null

在尝试更新数据库时遇到了一个问题,导致插入操作失败。错误信息指出'businessName'列不能为null。此问题可能与OpBusinessMapper.xml中的SQL映射有关,具体发生在设置参数时。已提供完整的堆栈跟踪以供进一步分析。
摘要由CSDN通过智能技术生成

Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘businessName’ cannot be null

The error may exist in OpBusinessMapper.xml

The error may involve BusinessMapper.insertBusi-Inline

The error occurred while setting parameters

SQL: insert into business(businessName, businessAddress, businessExplain, businessImg, orderTypeId, starPrice, deliveryPrice, remarks, password) values (?,?,?,?,?,?,?,?,?)

Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘businessName’ cannot be null

at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:200)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:185)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:180)
at TestBusiness.main(TestBusiness.java:43)

Caused by: java.sql.SQLIntegrityConstraintViolationException: Column ‘businessName’ cannot be null
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:117)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:970)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute(ClientPreparedStatement.java:387)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
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 org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:198)
… 3 more

Process finished with exit code 1

在这里插入图片描述

错误代码:

在这里插入图片描述

在这里插入图片描述

修改后的代码:

在这里插入图片描述

总结:
增删改查操作中涉及给值的一定要给值

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值