前言:在前后端分离项目中,我在运行插入数据的功能时,SQL语言已经在控制台显示,但是没有报出异常,而且数据库也没有插入数据
前端:
后端:
后面向人求助才知道,是已经抛出异常了,但是没在控制台输出,这时候,需要DBUG进入看异常信息(非常的坑)
具体信息是:
### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'number' cannot be null
### The error may exist in com/sky/mapper/ShoppingCartMapper.java (best guess)
### The error may involve com.sky.mapper.ShoppingCartMapper.insertOne-Inline
### The error occurred while setting parameters
### SQL: insert into shopping_cart (name, user_id, dish_id, setmeal_id, dish_flavor, number, amount, image, create_time) values (?,?,?,?,?,?,?,?,?)
### Cause: java.sql.SQLIntegrityConstraintViolationException: Column 'number' cannot be null
; Column 'number' cannot be null
很简单的错误,一看就懂。但是没有在控制台抛出异常,就很坑。。。。