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

在这里插入图片描述

错误代码:

在这里插入图片描述

在这里插入图片描述

修改后的代码:

在这里插入图片描述

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

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐