Error updating database. Cause: java.sql.SQLException: Field ‘goods_name’ doesn’t have a default value

The error may involve com.xuwem.show.mapper.OrderMapper.add-Inline

The error occurred while setting parameters

SQL: insert into ord ( user_id, charge_id, price, goods_num ) values( ?, ?, ?, ? )

Cause: java.sql.SQLException: Field ‘goods_name’ doesn’t have a default value

]
DEBUG [http-bio-9000-exec-1] - Written [[email protected]] as “application/json;charset=UTF-8” using [org.springfr[email protected]2f0d55dc]
DEBUG [http-bio-9000-exec-1] - Null ModelAndView returned to DispatcherServlet with name ‘springmvc’: assuming HandlerAdapter completed request handling
DEBUG [http-bio-9000-exec-1] - Successfully completed request

这里提示我动态sql出现问题,但是查看日志,语法没有什么问题。于是去前段查看参数绑定
一步一步坑上爬之动态sql坑参数是绑好的,也没有问题。
我就打印了移一下前端的传值,是空的。
问题来了,前台往后台的传值为空,才导致问题出现。那么,为什么会是空呢。

仔细检查后才知道,我前端绑参数是包装pojo,但是我springmvc里接收参数是包装pojo里的pojo,这才导致问题出现。
一步一步坑上爬之动态sql坑
修改参数类型,提取我要的参数,问题解决,特以此记录。

相关文章:

  • 2021-04-05
  • 2021-06-25
  • 2021-08-31
  • 2021-10-07
  • 2021-09-07
  • 2021-07-18
  • 2021-06-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2021-10-24
  • 2021-04-02
  • 2021-09-01
  • 2022-02-23
  • 2021-12-10
相关资源
相似解决方案